Created
September 2, 2015 15:19
-
-
Save jemacom/aed7f03c400618d107a8 to your computer and use it in GitHub Desktop.
Logstash conf file to parse pfsense logs
This file contains hidden or 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
input { | |
syslog { | |
type => "pfsense" | |
} | |
} | |
filter { | |
if [type] == "pfsense" { | |
grok { | |
patterns_dir => "/opt/logstash/patterns" | |
match => [ | |
"message", "%{PFSENSE}" ] | |
} | |
if [prog] == "filterlog" { | |
grok { | |
patterns_dir => "/opt/logstash/patterns" | |
match => [ "msg", "%{LOG_DATA}%{IP_SPECIFIC_DATA}%{IP_DATA}%{PROTOCOL_DATA}" ] | |
} | |
geoip { | |
#database => "/opt/logstash/GeoLiteCity.dat" | |
source => "src_ip" | |
target => "geoip" | |
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ] | |
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ] | |
} | |
mutate { | |
convert => [ "[geoip][coordinates]", "float" ] | |
remove_tag => [ "_grokparsefailure" ] | |
} | |
} | |
} | |
} | |
output { | |
stdout { codec => dots } | |
elasticsearch { | |
protocol => "http" | |
host => "elkserver" | |
cluster => "mycluster" | |
index => "pfsense-logs-%{+dd.MM.YYYY}" | |
#index => "pfsense-logs" | |
} | |
if "ntopng" in [message] { | |
stdout { codec => rubydebug } | |
email { | |
options => [ | |
"smtpIporHost" , "mail.iptech-group.com", | |
"port" , "26", | |
"userName" , "[email protected]", | |
"password", "P@ssword", | |
"authenticationType" , "login" | |
] | |
from => "<[email protected]>" | |
cc => "<[email protected]>" | |
to => "<[email protected]>" | |
subject => "Logstash alert (TEST) " | |
htmlbody => " | |
<html> | |
<body> | |
<table border=\"1\"> | |
<tbody> | |
<tr bgcolor=\"#99FF66\"> | |
<td>Pfsense email emergency report :</td> | |
</tr> | |
<tr bgcolor=\"#FF6600\"> | |
<td>ERROR </td> | |
<td> ntopn fails to start %{date} at host %{host}</td> | |
<td> %{msg}</td> | |
</tr> | |
</tbody> | |
</table> | |
</body></html> | |
" | |
via => "smtp" | |
} | |
} | |
if "flooder" in [message]{ | |
stdout { codec => rubydebug } | |
email { | |
via => "smtp" | |
options => [ | |
"smtpIporHost" , "mail.iptech-group.com", | |
"port" , "26", | |
"userName" , "[email protected]", | |
"password", "P@ssword", | |
"authenticationType" , "login" | |
] | |
from => "<[email protected]>" | |
to => "<[email protected]>" | |
subject => "Logstash alert (TEST) " | |
htmlbody => " | |
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> | |
<html xmlns=\"http://www.w3.org/1999/xhtml\" style=\"font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;\"> | |
<body> | |
<table border=\"1\"> | |
<tbody> | |
<tr bgcolor=\"#99FF66\"> | |
<td>Pfsense email emergency report :</td> | |
</tr> | |
<tr bgcolor=\"#FF6600\"> | |
<td>ERROR </td> | |
<td> ntopn fails to start %{date} at host %{host}</td> | |
<td> %{msg}</td> | |
</tr> | |
</tbody> | |
</table> | |
</body></html> | |
" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment