Last active
August 29, 2015 14:08
-
-
Save bre7/639bf20142f4248c1f99 to your computer and use it in GitHub Desktop.
Logstash.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
stdin { | |
type => "apache-access" | |
} | |
} | |
filter { | |
grok { match => { "message" => "%{COMBINEDAPACHELOG}" } } | |
date { | |
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ] | |
locale => "en" | |
} | |
if [clientip] { | |
geoip { | |
source => "clientip" | |
target => "geoip" | |
add_field => ["[geoip][coordinates]","%{[geoip][longitude]}"] | |
add_field => ["[geoip][coordinates]","%{[geoip][latitude]}"] | |
} | |
mutate { | |
convert => [ "[geoip][coordinates]", "float" ] | |
} | |
} | |
if [agent] != "-" and [agent] != "" { | |
useragent { | |
add_tag => [ "UA" ] | |
source => "agent" | |
prefix => "useragent_" | |
} | |
} | |
if "UA" in [tags] { | |
if [useragent_device] == "Other" { mutate { remove_field => "device" } } | |
if [useragent_name] == "Other" { mutate { remove_field => "name" } } | |
if [useragent_os] == "Other" { mutate { remove_field => "os" } } | |
} | |
} | |
output { | |
elasticsearch { host => localhost } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment