Skip to content

Instantly share code, notes, and snippets.

@roopendra
Last active November 25, 2016 12:31
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 roopendra/eca2eb6047c7ce47cf2302820aff3242 to your computer and use it in GitHub Desktop.
Save roopendra/eca2eb6047c7ce47cf2302820aff3242 to your computer and use it in GitHub Desktop.
Logstash conf to parse apache log with geoip and browser agent fields.
input {
stdin { }
}
filter {
grok {
match => {
"message" => '%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{DATA:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:response:int} (?:-|%{NUMBER:bytes:int}) %{QS:referrer} %{QS:agent}'
}
}
date {
match => [ "timestamp", "dd/MMM/YYYY:HH:mm:ss Z" ]
locale => en
}
geoip {
source => "clientip"
}
useragent {
source => "agent"
target => "useragent"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "apache_access_logs"
template => "apache_sizing_2.json"
template_name => "elk_workshop"
template_overwrite => true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment