Skip to content

Instantly share code, notes, and snippets.

@ewr
Created July 10, 2015 16:40
Show Gist options
  • Save ewr/50515f709fc00c3bdff8 to your computer and use it in GitHub Desktop.
Save ewr/50515f709fc00c3bdff8 to your computer and use it in GitHub Desktop.
KPCC Logstash Config for Podcasts
filter {
if [type] == "nginx" {
grok {
match => ["message", "%{NGINXACCESS}" ]
}
grok {
match => ["request","%{URIPATH:request_path}(?:%{URIPARAM:request_params})?"]
}
date {
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss" ]
}
kv {
source => "request_params"
field_split => "&?"
prefix => "q"
}
geoip {
source => "clientip"
}
mutate {
gsub => [
"agent", "(?:^\"|\"$)","",
"range_request", "(?:^\"|\"$)",""
]
}
}
}
NGUSERNAME [a-zA-Z\.\@\-\+_%]+
NGUSER %{NGUSERNAME}
NGINXACCESS %{IPORHOST:clientip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:response} (?:%{NUMBER:bytes_sent:int}|-) (?:"(?:%{URI:referrer}|-)"|%{QS:referrer}) %{QS:agent}(?: %{NUMBER:request_time:float} (?:%{NUMBER:upstream_time:float}|\-) [\w\.](?: %{QS:range_request})?)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment