Skip to content

Instantly share code, notes, and snippets.

@cgswong
Last active August 29, 2015 14:17
Show Gist options
  • Save cgswong/a54d51e673e1a5b844ca to your computer and use it in GitHub Desktop.
Save cgswong/a54d51e673e1a5b844ca to your computer and use it in GitHub Desktop.
Basic logstash configuration for logspout
input {
tcp {
port => 5000
type => "dockerlog"
}
udp {
port => 5000
type => "dockerlog"
}
}
filter {
if [type] == "dockerlog" {
grok {
match => { "message" => "%{SYSLOG5424PRI}%{NONNEGINT:ver} +(?:%{TIMESTAMP_ISO8601:ts}|-) +(?:%{HOSTNAME:containerid}|-) +(?:%{NOTSPACE:containername}|-) +(?:%{NOTSPACE:proc}|-) +(?:%{WORD:msgid}|-) +(?:%{SYSLOG5424SD:sd}|-|) +%{GREEDYDATA:msg}" }
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
if !("_grokparsefailure" in [tags]) {
mutate {
replace => [ "@source_host", "%{syslog_hostname}" ]
replace => [ "@message", "%{syslog_message}" ]
}
}
mutate {
remove_field => [ "syslog_hostname", "syslog_message", "syslog_timestamp" ]
}
}
}
output {
elasticsearch {
host => "elasticsearch"
}
stdout { codec => rubydebug }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment