logstash - Present average processing time in Kibana -


i have application logs logstash in below format.

{ "timestamp": "2015-09-09t10:54:57.4562725+00:00", "message": "started processing", "messageid": "b80fb2aa-4b7b-4f49-9e60-865c6afa688e", "clientname": "testclient" 

}

{ "timestamp": "2015-09-09t10:55:57.4562725+00:00", "message": "done processing", "messageid": "b80fb2aa-4b7b-4f49-9e60-865c6afa688e", "clientname": "testclient" 

}

{ "timestamp": "2015-09-09t10:55:57.4562727+00:00", "message": "time elapsed: 561 ms", "messageid": "b80fb2aa-4b7b-4f49-9e60-865c6afa688e", "clientname": "testclient" 

}

what trying achieve average processing time (all logging done same messageid part of 1 processing cycle).

the last log in every transaction has processing time ( shown above: "message": "time elapsed: 561 ms"), how can average? ideas?

you'll need extract milliseconds in message "time elapsed" using grok filter, pass metrics filter. you'll %{processingtime.mean} variable can use in filters or output. like:

filter {   grok {     match => { "message" => "time elapsed: %{int:processingtime} ms" }     add_tag => [ "has_processingtime" ]   }   if "has_processingtime" in [tags] {     metrics {       timer => [ "processingtime", "%processingtime" ]       add_tag => "metric"     }   } } 

additionally, you'll other interesting metrics min, max, percentiles, , rates. see https://www.elastic.co/guide/en/logstash/current/plugins-filters-metrics.html.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -