Created
July 6, 2016 07:18
-
-
Save boeboe/3f7503b1246b8d963debe7208e3dd86f to your computer and use it in GitHub Desktop.
Logstash configuration file
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 { | |
beats { | |
port => 5044 | |
} | |
} | |
filter { | |
if [type] == "syslog" { | |
grok { | |
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" } | |
add_field => [ "received_at", "%{@timestamp}" ] | |
add_field => [ "received_from", "%{host}" ] | |
} | |
syslog_pri { } | |
date { | |
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ] | |
} | |
} | |
} | |
filter { | |
if [type] == "nginx-access" { | |
grok { | |
patterns_dir => ["/etc/logstash/conf.d/patterns"] | |
match => { "message" => "%{NGINXACCESS}" } | |
} | |
} else if [type] == "nginx-error" { | |
grok { | |
patterns_dir => ["/etc/logstash/conf.d/patterns"] | |
match => [ | |
"message", "%{NGINXERROR1}", | |
"message", "%{NGINXERROR2}", | |
"message", "%{NGINXERROR3}" | |
] | |
} | |
} | |
} | |
output { | |
elasticsearch { | |
hosts => ["http://elk-elasticsearch01.romcore.rom:9200"] | |
manage_template => false | |
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}" | |
document_type => "%{[@metadata][type]}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment