Skip to content

Instantly share code, notes, and snippets.

@hacktvist
Created January 7, 2015 12:46
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 hacktvist/b8f60d4ba41a6524ff87 to your computer and use it in GitHub Desktop.
Save hacktvist/b8f60d4ba41a6524ff87 to your computer and use it in GitHub Desktop.
filter {
if "apache_access_json" in [tags] {
if [useragent] != "-" and [useragent] != "" {
useragent {
add_tag => [ "UA" ]
source => "useragent"
prefix => "UA-"
}
}
mutate {
convert => ['duration', 'float']
}
ruby {
code => "event['duration']/=1000000"
}
if [bytes] == 0 { mutate { remove_field => "[bytes]" } }
if [urlquery] == "" { mutate { remove_field => "urlquery" } }
if [method] =~ "(HEAD|OPTIONS)" { mutate { remove_field => "method" } }
if [useragent] == "-" { mutate { remove_field => "useragent" } }
if [referer] == "-" { mutate { remove_field => "referer" } }
if "UA" in [tags] {
if [device] == "Other" { mutate { remove_field => "device" } }
if [name] == "Other" { mutate { remove_field => "name" } }
if [os] == "Other" { mutate { remove_field => "os" } }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment