Skip to content

Instantly share code, notes, and snippets.

@crashdump
Created October 26, 2012 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crashdump/3958027 to your computer and use it in GitHub Desktop.
Save crashdump/3958027 to your computer and use it in GitHub Desktop.
Logstash configuration
# This is a configuration for Logstash acting like that:
#
## INPUT
# - Syslog server listening on (custom >1024 as we don't run it as root) UDP/10514
# - GELF event listening on (default) UDP/12201
#
## FILTERING
# - Nothing here yet
#
## OUTPUT
# -
#
input {
udp {
port => 10514
type => "syslog-udp-10514"
}
}
filter {
grok {
type => "syslog-udp-10514"
pattern => [ "<%%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP: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-udp-10514"
}
date {
type => "syslog-udp-10514"
syslog_timestamp => [ "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
mutate {
type => "syslog-udp-10514"
exclude_tags => "_grokparsefailure"
replace => [ "@source_host", "%{syslog_hostname}" ]
replace => [ "@message", "%{syslog_message}" ]
}
mutate {
type => "syslog-udp-10514"
remove => [ "syslog_hostname", "syslog_message", "syslog_timestamp" ]
}
}
output {
stdout { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment