]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/logstash/templates/default/logstash.conf.erb
Tag logstash events as frontend or backend
[chef.git] / cookbooks / logstash / templates / default / logstash.conf.erb
index 0ddab7b2fc651e5fff1bc993b520a52ab5de6786..cd5a7d24ab901095d28cfe3239b57932eb815f41 100644 (file)
@@ -14,6 +14,19 @@ filter {
     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"
@@ -26,6 +39,16 @@ filter {
       ]
     }
   }
+
+  if [host] =~ /^spike-/ {
+    mutate {
+      add_tag => [ "frontend" ]
+    }
+  } else if [host] =~ /^thorn-/ {
+    mutate {
+      add_tag => [ "backend" ]
+    }
+  }
 }
 
 output {