Created
May 15, 2016 18:28
-
-
Save pgstenberg/8312688913a6df95172ad0ddccb84040 to your computer and use it in GitHub Desktop.
logstash configuration example for kafka consuming logs
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
input { | |
syslog { | |
type => "haproxy-access" | |
port => 5000 | |
} | |
log4j { | |
mode => "server" | |
host => "0.0.0.0" | |
port => 3456 | |
type => "zookeeper" | |
} | |
} | |
output { | |
if [type] == "haproxy-access" { | |
kafka { | |
bootstrap_servers => "zookeeperkafka:9092" | |
topic_id => "logstash.haproxy" | |
} | |
} | |
else if [type] == "zookeeper" { | |
kafka { | |
bootstrap_servers => "zookeeperkafka:9092" | |
topic_id => "logstash.zookeeper" | |
} | |
} | |
} |
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
input { | |
kafka { | |
type => "haproxy-access" | |
zk_connect => "zookeeperkafka:2181" | |
topic_id => "logstash.haproxy" | |
} | |
kafka { | |
type => "zookeeper" | |
zk_connect => "zookeeperkafka:2181" | |
topic_id => "logstash.zookeeper" | |
} | |
} | |
filter { | |
if [type] == "haproxy-access" { | |
grok { | |
match => ["message", "%{HAPROXYHTTP}"] | |
} | |
mutate { | |
add_tag => ["HAPROXY"] | |
} | |
} | |
else if [type] == "zookeeper" { | |
grok { | |
match => { "logger_name" => "org\.apache\.zookeeper\.server\.quorum.*" } | |
add_tag => ["LOOOOOOOOOOOL"] | |
} | |
} | |
} | |
output { | |
if [type] == "haproxy-access" { | |
elasticsearch { | |
hosts => ["elasticsearch:9200"] | |
index => "haproxy-%{+YYYY.MM.dd}" | |
} | |
} | |
else if [type] == "zookeeper" { | |
elasticsearch { | |
hosts => ["elasticsearch:9200"] | |
index => "zookeeper-%{+YYYY.MM.dd}" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment