mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00

- Large rework on packet filter framework to make many things easier. - Removed the PacketFilter::all_packets variable because it was confusing. - New variable (PacketFilter::enable_auto_protocol_capture_filters) to re-enable the old filtering model of only sniffing ports for analyzed protocols. - In progress plugin model for adding filtering mechanisms. - New default single item for capture_filters = { ["default"] = PacketFilter::default_capture_filter }; - Mechanism and helper functions to "shunt" traffic with filters. - Created the Protocols framework to assist with reworking how base protocol scripts are registered with DPD and other things. - Protocols framework creates BPF filters for registered analyzers. (if using PacketFilter framework in that mode).
59 lines
1.5 KiB
Text
59 lines
1.5 KiB
Text
##! Core script support for logging syslog messages. This script represents
|
|
##! one syslog message as one logged record.
|
|
|
|
@load base/frameworks/protocols
|
|
@load ./consts
|
|
|
|
module Syslog;
|
|
|
|
export {
|
|
redef enum Log::ID += { LOG };
|
|
|
|
type Info: record {
|
|
## Timestamp of when the syslog message was seen.
|
|
ts: time &log;
|
|
uid: string &log;
|
|
id: conn_id &log;
|
|
## Protocol over which the message was seen.
|
|
proto: transport_proto &log;
|
|
## Syslog facility for the message.
|
|
facility: string &log;
|
|
## Syslog severity for the message.
|
|
severity: string &log;
|
|
## The plain text message.
|
|
message: string &log;
|
|
};
|
|
}
|
|
|
|
global analyzers = { ANALYZER_SYSLOG_BINPAC };
|
|
redef Protocols::analyzer_map["SYSLOG"] = analyzers;
|
|
global ports = { 514/udp };
|
|
redef Protocols::common_ports["SYSLOG"] = ports;
|
|
|
|
redef record connection += {
|
|
syslog: Info &optional;
|
|
};
|
|
|
|
event bro_init() &priority=5
|
|
{
|
|
Log::create_stream(Syslog::LOG, [$columns=Info]);
|
|
}
|
|
|
|
event syslog_message(c: connection, facility: count, severity: count, msg: string) &priority=5
|
|
{
|
|
local info: Info;
|
|
info$ts=network_time();
|
|
info$uid=c$uid;
|
|
info$id=c$id;
|
|
info$proto=get_port_transport_proto(c$id$resp_p);
|
|
info$facility=facility_codes[facility];
|
|
info$severity=severity_codes[severity];
|
|
info$message=msg;
|
|
|
|
c$syslog = info;
|
|
}
|
|
|
|
event syslog_message(c: connection, facility: count, severity: count, msg: string) &priority=-5
|
|
{
|
|
Log::write(Syslog::LOG, c$syslog);
|
|
}
|