Skip to content

Instantly share code, notes, and snippets.

@bre7
Last active August 29, 2015 14:08
Show Gist options
  • Save bre7/639bf20142f4248c1f99 to your computer and use it in GitHub Desktop.
Save bre7/639bf20142f4248c1f99 to your computer and use it in GitHub Desktop.
Logstash.conf
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