Skip to content

Instantly share code, notes, and snippets.

@literadix
Created September 20, 2018 09:34
Show Gist options
  • Save literadix/cf456dbb84641c342be7e2b576ad3847 to your computer and use it in GitHub Desktop.
Save literadix/cf456dbb84641c342be7e2b576ad3847 to your computer and use it in GitHub Desktop.
input {
gelf {}
}
filter {
if [message] {
grok {
match => { "message" => "%{IPORHOST:remote_ip} - %{DATA:user_name} \[%{HTTPDATE:access_time}\] \"%{WORD:http_method} %{DATA:url} HTTP/%{NUMBER:http_version}\" %{NUMBER:response_code} %{NUMBER:body_sent_bytes} \"%{DATA:referrer}\" \"%{DATA:agent}\"" }
}
if "_grokparsefailure" in [tags] {
}
else {
mutate {
convert => { "bytes" => "integer" }
}
}
}
geoip {
source => "remote_ip"
target => "geoip"
database => "/var/opt/GeoLite2-City/GeoLite2-City.mmdb"
fields => ["country_name", "country_code3", "region_name", "city_name", "location"]
}
}
output {
elasticsearch {
hosts => ["elasticsearch"]
}
stdout {
codec => rubydebug
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment