mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/syslog-missing-pri'
* origin/topic/jsiwek/syslog-missing-pri: Make Syslog analyzer accept messages that omit Priority
This commit is contained in:
commit
210a4361fa
9 changed files with 61 additions and 14 deletions
5
CHANGES
5
CHANGES
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
2.6-197 | 2019-04-03 09:08:58 -0700
|
||||||
|
|
||||||
|
* Make Syslog analyzer accept non-conformant messages that omit Priority.
|
||||||
|
(Jon Siwek, Corelight)
|
||||||
|
|
||||||
2.6-195 | 2019-03-27 12:36:34 -0700
|
2.6-195 | 2019-03-27 12:36:34 -0700
|
||||||
|
|
||||||
* Reduce weird-stats overhead (Justin Azoff, Corelight)
|
* Reduce weird-stats overhead (Justin Azoff, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.6-195
|
2.6-197
|
||||||
|
|
2
doc
2
doc
|
@ -1 +1 @@
|
||||||
Subproject commit e404fc80c5c4ecfd0c4441b6b83826761bd985e9
|
Subproject commit 2e66f807daafe754e40571e3d2c10080b6db36cb
|
|
@ -29,6 +29,7 @@ export {
|
||||||
[21] = "LOCAL5",
|
[21] = "LOCAL5",
|
||||||
[22] = "LOCAL6",
|
[22] = "LOCAL6",
|
||||||
[23] = "LOCAL7",
|
[23] = "LOCAL7",
|
||||||
|
[999] = "UNSPECIFIED",
|
||||||
} &default=function(c: count): string { return fmt("?-%d", c); };
|
} &default=function(c: count): string { return fmt("?-%d", c); };
|
||||||
|
|
||||||
## Mapping between the constants and string values for syslog severities.
|
## Mapping between the constants and string values for syslog severities.
|
||||||
|
@ -41,5 +42,6 @@ export {
|
||||||
[5] = "NOTICE",
|
[5] = "NOTICE",
|
||||||
[6] = "INFO",
|
[6] = "INFO",
|
||||||
[7] = "DEBUG",
|
[7] = "DEBUG",
|
||||||
|
[999] = "UNSPECIFIED",
|
||||||
} &default=function(c: count): string { return fmt("?-%d", c); };
|
} &default=function(c: count): string { return fmt("?-%d", c); };
|
||||||
}
|
}
|
|
@ -7,16 +7,27 @@ connection Syslog_Conn(bro_analyzer: BroAnalyzer)
|
||||||
|
|
||||||
flow Syslog_Flow
|
flow Syslog_Flow
|
||||||
{
|
{
|
||||||
datagram = Syslog_Message withcontext(connection, this);
|
datagram = Syslog_Message_Optional_PRI withcontext(connection, this);
|
||||||
|
|
||||||
function process_syslog_message(m: Syslog_Message): bool
|
function process_syslog_message(m: Syslog_Message): bool
|
||||||
%{
|
%{
|
||||||
BifEvent::generate_syslog_message(connection()->bro_analyzer(),
|
if ( ${m.has_pri} )
|
||||||
|
BifEvent::generate_syslog_message(
|
||||||
|
connection()->bro_analyzer(),
|
||||||
connection()->bro_analyzer()->Conn(),
|
connection()->bro_analyzer()->Conn(),
|
||||||
${m.PRI.facility},
|
${m.PRI.facility},
|
||||||
${m.PRI.severity},
|
${m.PRI.severity},
|
||||||
new StringVal(${m.msg}.length(), (const char*)${m.msg}.begin())
|
new StringVal(${m.msg}.length(), (const char*)${m.msg}.begin())
|
||||||
);
|
);
|
||||||
|
else
|
||||||
|
BifEvent::generate_syslog_message(
|
||||||
|
connection()->bro_analyzer(),
|
||||||
|
connection()->bro_analyzer()->Conn(),
|
||||||
|
999,
|
||||||
|
999,
|
||||||
|
new StringVal(${m.msg}.length(), (const char*)${m.msg}.begin())
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,27 @@
|
||||||
type Syslog_Message = record {
|
type Syslog_Message_Optional_PRI = record {
|
||||||
PRI: Syslog_Priority;
|
lt: uint8;
|
||||||
|
after_lt: bytestring &restofdata &transient;
|
||||||
|
}
|
||||||
|
&byteorder = littleendian
|
||||||
|
&exportsourcedata
|
||||||
|
&let {
|
||||||
|
standard: Syslog_Message(true) withinput sourcedata &if(lt == 60); # '<'
|
||||||
|
nonstandard: Syslog_Message(false) withinput sourcedata &if(lt != 60);
|
||||||
|
};
|
||||||
|
|
||||||
|
type Syslog_Message(has_pri: bool) = record {
|
||||||
|
opt_pri: case has_pri of {
|
||||||
|
true -> PRI: Syslog_Priority;
|
||||||
|
false -> nothing: empty;
|
||||||
|
};
|
||||||
|
|
||||||
msg: bytestring &restofdata;
|
msg: bytestring &restofdata;
|
||||||
} &byteorder = littleendian;
|
} &byteorder = littleendian;
|
||||||
|
|
||||||
type Syslog_Priority = record {
|
type Syslog_Priority = record {
|
||||||
lt : uint8; # &check(lt == 60); # '<'
|
lt : uint8 &enforce(lt == 60); # '<'
|
||||||
val : RE/[[:digit:]]+/;
|
val : RE/[[:digit:]]+/;
|
||||||
gt : uint8; # &check(gt == 62); # '>'
|
gt : uint8 &enforce(gt == 62); # '>'
|
||||||
} &let {
|
} &let {
|
||||||
val_length: int = sizeof(val) - 1;
|
val_length: int = sizeof(val) - 1;
|
||||||
int_val: int = bytestring_to_int(val, 10);
|
int_val: int = bytestring_to_int(val, 10);
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#separator \x09
|
||||||
|
#set_separator ,
|
||||||
|
#empty_field (empty)
|
||||||
|
#unset_field -
|
||||||
|
#path syslog
|
||||||
|
#open 2019-03-15-01-41-39
|
||||||
|
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto facility severity message
|
||||||
|
#types time string addr port addr port enum string string string
|
||||||
|
1552584410.781231 CHhAvVGS1DHFjwGM9 192.168.2.118 60786 192.168.2.21 514 udp UNSPECIFIED UNSPECIFIED This is not really a syslog message #173538 1552584410.781186
|
||||||
|
#close 2019-03-15-01-41-39
|
BIN
testing/btest/Traces/syslog-missing-pri.trace
Executable file
BIN
testing/btest/Traces/syslog-missing-pri.trace
Executable file
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
# @TEST-EXEC: bro -r $TRACES/syslog-missing-pri.trace %INPUT
|
||||||
|
# @TEST-EXEC: btest-diff syslog.log
|
||||||
|
|
||||||
|
@load base/protocols/syslog
|
Loading…
Add table
Add a link
Reference in a new issue