Calculate ratio of success in a field kibana

Hi all,

i have a field named Status that contains values (ok and failed), i want to visualise the ratio of success under a metric visualisation (i dont want to use a pie chart) is that possible through scripted field or logstash.

my formula will be:
((count when status=ok)/total count)*100

any help

thanks in advance

Hi,

This definitely should work using scripted fields. Here is the documentation for it.
https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

You need to add a field, choose painless and write your script.

Here is the language/syntax specification:
https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-specification.html

Cheers,
Bhavya

thank you but as far as i know the scripted field doesn't return the count of a string inside a field what i am thinking to do is to add another field that have the same value of the Status field then use gsub filter to replace OK by 1 and Failed by 0 then convert it to integer.
finally i can use my scripted field like this:

(doc['Field'].sum/doc['Field'].length)*100 hope this work this will the success rate

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.