Last active
July 9, 2016 09:44
-
-
Save elijahpaul/169810a53d14c8a62910 to your computer and use it in GitHub Desktop.
pfSense 2.2 Logstash Filter
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
# Use this filter with pattern file https://gist.github.com/elijahpaul/f5f32d4e914dcb7fedd2 | |
filter { | |
if "PFSense" in [tags] { | |
grok { | |
add_tag => [ "firewall" ] | |
match => [ "message", "<(?<evtid>.*)>(?<datetime>(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9]) (?:2[0123]|[01]?[0-9]):(?:[0-5][0-9]):(?:[0-5][0-9])) (?<prog>.*?): (?<msg>.*)" ] | |
} | |
mutate { | |
gsub => ["datetime"," "," "] | |
} | |
date { | |
match => [ "datetime", "MMM dd HH:mm:ss" ] | |
} | |
mutate { | |
replace => [ "message", "%{msg}" ] | |
} | |
mutate { | |
remove_field => [ "msg", "datetime" ] | |
} | |
} | |
if [prog] =~ /^filterlog$/ { | |
mutate { | |
remove_field => [ "msg", "datetime" ] | |
} | |
grok { | |
patterns_dir => "./patterns" | |
match => [ "message", "%{LOG_DATA}%{IP_SPECIFIC_DATA}%{IP_DATA}%{PROTOCOL_DATA}" ] | |
} | |
mutate { | |
lowercase => [ 'proto' ] | |
} | |
geoip { | |
add_tag => [ "GeoIP" ] | |
source => "src_ip" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment