Skip to content

Instantly share code, notes, and snippets.

@gansbrest
Created November 21, 2014 18:33
Show Gist options
  • Save gansbrest/af76770957c79aaf68c6 to your computer and use it in GitHub Desktop.
Save gansbrest/af76770957c79aaf68c6 to your computer and use it in GitHub Desktop.
input {
tcp {
'port' => 3333
'type' => 'router_nginx_logs'
}
# Some additional inputs could be here as well
}
filter {
grok {
'patterns_dir' => '/opt/logstash/agent/etc/patterns'
'add_tag' => ['router_nginx_logs_extracted']
'match' => ['message', '%{NUMBER:msec}\s+%{IP:client_ip}\s+(%{WORD:remote_user}|-)\s+%{TIMESTAMP_ISO8601:logtime}\s+%{WORD:method} %{NOTSPACE:uri} (?:HTTP/%{NUMBER:version})\s+%{NUMBER:status:int}\s+(?:%{NUMBER:bytes_sent:int})\s+%{QS:referer}\s+%{QS:agent}\s+(%{WORD,country_code}|-)\s+(%{NUMBER:request_time:float}|-)\s+%{QS:http_fwd_for}\s+%{HOST:http_host}\s+(%{WORD:instance_id}|-)']
'type' => 'router_nginx_logs'
}
date {
'type' => 'router_nginx_logs'
'match' => ["logtime", "yyyy-MM-dd'T'HH:mm:ssZ"]
}
}
output {
# Your regular outputs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment