]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/logstash/templates/default/logstash.conf.erb
Parse user agent details
[chef.git] / cookbooks / logstash / templates / default / logstash.conf.erb
index 7608e2b5b2555fd63a574cd5d0827c4ef56425f3..c036c1f7aab61c23e38b05edcd2198b59df863ad 100644 (file)
@@ -14,12 +14,29 @@ filter {
     date {
       match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
     }
     date {
       match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
     }
+    if [agent] == "-" {
+      mutate {
+        remove_field => [ "agent" ]
+      }
+    } else {
+      useragent {
+        source => "agent"
+        target => "useragent"
+      }
+      mutate {
+        rename => { "agent" => "[useragent][raw]" }
+      }
+    }
   } else if [type] == "rails" {
     json {
       source => "message"
   } else if [type] == "rails" {
     json {
       source => "message"
-    }
-    mutate {
-      remove_field => [ "message" ]
+      remove_field => [
+        "message",
+        "[parameters][authenticity_token]",
+        "[parameters][pass_crypt]",
+        "[parameters][pass_crypt_confirmation]",
+        "[parameters][utf8]"
+      ]
     }
   }
 }
     }
   }
 }