Created
April 11, 2013 07:31
-
-
Save jalogisch/5361450 to your computer and use it in GitHub Desktop.
This Logstash Configuration takes Syslog Messages, add some additional Fields and Information to them and send them via GELF to graylog2-radio which put them into rabbitmq transport Inspiration from: http://cookbook.logstash.net/recipes/syslog-pri/ (but little modified to match my needs)
http://blog.torch.sh/post/43651465177/introducing-graylog2…
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 { | |
tcp { | |
port => 514 | |
type => syslog | |
} | |
udp { | |
port => 514 | |
type => syslog | |
} | |
} | |
filter { | |
grok { | |
type => "syslog" | |
pattern => [ "<%{POSINT:syslog_pri}>(%{SYSLOGTIMESTAMP:syslog_timestamp}|%{TIMESTAMP_ISO8601:syslog_timestamp}) %{SYSLOGHOST:syslog_hostname} %{PROG:syslog_program}(?:\[%{POSINT:syslog_pid}\])?(:)? %{GREEDYDATA:syslog_message}" ] | |
add_field => [ "received_at", "%{@timestamp}" ] | |
add_field => [ "received_from", "%{@source_host}" ] | |
} | |
syslog_pri { | |
type => "syslog" | |
} | |
date { | |
type => "syslog" | |
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ] | |
} | |
mutate { | |
type => "syslog" | |
exclude_tags => "_grokparsefailure" | |
replace => [ "@source_host", "%{syslog_hostname}" ] | |
replace => [ "@message", "%{syslog_message}" ] | |
} | |
mutate { | |
type => "syslog" | |
remove => [ "syslog_hostname", "syslog_message", "syslog_timestamp" ] | |
} | |
} | |
output { | |
# Emit events to stdout for easy debugging of what is going through | |
# logstash. | |
# stdout { } | |
gelf { | |
chunksize => 1420 | |
facility => "%{syslog_facility}" | |
host => "localhost" | |
level => "%{syslog_severity}" | |
# we queue them via amqp | |
port => 12502 | |
sender => "%{@source_host}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment