Created
July 19, 2016 21:26
-
-
Save lennartkoopmann/5dd37048733e43f835f989b6fb3b287b to your computer and use it in GitHub Desktop.
Parsing a Snort alert message with the Graylog Processor Pipelines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rule "Extract Snort alert fields" | |
when | |
has_field("message") | |
then | |
let m = regex("^\\s?\\[(\\d+):(\\d+):(\\d+)\\] (.+?) \\[Classification: (.+?)\\] \\[Priority: (\\d+)] \\{(.+?)\\} (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d{1,5}) -> (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d{1,5})\\R?", to_string($message.message)); | |
set_field("snort_alert", true); | |
set_field("generator_id", m["0"]); | |
set_field("signature_id", m["1"]); | |
set_field("signature_revision_id", m["2"]); | |
set_field("description", m["3"]); | |
set_field("classification", m["4"]); | |
set_field("priority", to_long(m["5"])); | |
set_field("protocol", m["6"]); | |
set_field("src_addr", to_ip(m["7"])); | |
set_field("src_port", to_long(m["8"])); | |
set_field("dst_addr", to_ip(m["9"])); | |
set_field("dst_port", to_long(m["10"])); | |
end |
which regular expression did you use here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While using this rule set, message or full-message as i've tested aren't getting parsed correctly - any thoughts?