Last active
March 8, 2018 07:26
-
-
Save soulsearcher/3bd64646b4e881564b79615038e004cc to your computer and use it in GitHub Desktop.
logstash pipeline for iptables
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 { | |
# dummy data from files | |
file { | |
path => "D:/dev/sample-logs/iptables/iptables-*" | |
start_position => "beginning" | |
} | |
beats { | |
port => 5044 | |
} | |
} | |
filter { | |
grok { | |
# iptables grok patterns | |
# https://gist.github.com/Caligatio/1c1ef69dd720186cfacf95c1cd8ea85d | |
patterns_dir => ["D:/dev/elastic/logstash/patterns"] | |
match => { | |
"message" => "%{SYSLOGBASE} %{WORD} Log : %{IPTABLES}" | |
} | |
} | |
date { | |
match => ["timestamp", "MMM dd HH:mm:ss", "MMM d HH:mm:ss"] | |
target => "@timestamp" | |
} | |
geoip { | |
source => "src_ip" | |
} | |
geoip { | |
source => "dest_ip" | |
} | |
if "_grokparsefailure" in [tags] { | |
drop { } | |
} | |
} | |
output { | |
# send to elasticsearch | |
elasticsearch { | |
hosts => ["localhost:9200"] | |
index => "iptables-%{+YYYY.MM.dd}" | |
} | |
# debug | |
stdout { codec => rubydebug } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment