Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
Created January 21, 2013 11:48
Show Gist options
  • Save thattommyhall/4585540 to your computer and use it in GitHub Desktop.
Save thattommyhall/4585540 to your computer and use it in GitHub Desktop.
input {
tcp {
port => 5544
type => syslog
}
udp {
port => 5544
type => syslog
}
}
filter {
#Standard syslog stuff
grok {
type => "syslog"
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"
}
date {
type => "syslog"
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" ]
}
#add tag to apache logs
grep {
type => "syslog"
match => [ "syslog_program", "apache-access" ]
add_tag => [ "apache-access" ]
}
grok {
tag => "apache-access"
pattern => "%{IPORHOST:clientip} %{IPORHOST:site} \[%{HTTPDATE:timestamp}\] \"(?:%{WORD:verb} %{URIPATHPARAM:request}(?: HTTP/%{NUMBER:httpversion})?|-)\" %{NUMBER:response} (?:%{NUMBER:bytes}|-) \"(?:%{URI:referrer}|-)\" %{QS:agent}"
}
}
output {
stdout {
debug => true
}
elasticsearch {
embedded => true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment