I am new to Graylog and watched a recent video by Lawrence Systems on Graylog.
Rather than use an extractor, I’m attempting to parse pf filterlog CSV log lines into fields via pipeline rules.
For example:
rule "filterlog IPv4 TCP"
when
has_field("message") &&
contains(to_string($message.application_name), "filterlog") &&
regex("^.+,(in|out),4,.*,tcp,.*$", to_string($message.message)).matches == true
then
//set_field("filterlog", "tcp");
let keys = [
"RuleNumber", "SubRuleNumber", "Anchor", "Tracker", "Interface", "Reason", "Action", "Direction", "IPVersion",
"TOS", "ECN", "TTL", "ID", "Offset", "Flags", "ProtocolID", "Protocol", "Length", "SourceIP", "DestIP",
"SourcePort", "DestPort", "DataLength", "TCPFlags", "Sequence", "ACK", "Window", "URG", "Options"
];
let values = split(",", to_string($message.message));
let map = {}; // Create map from keys,values lists?
set_fields(
fields: map
);
end
I cannot figure out how to construct map
, from keys
and values
, in order to pass to set_fields()
.
How might I do that?
Also, I do not understand what role the message
argument to set_fields()
plays.
I am using graylog 4.2.
Any advice would be much appreciated.