How do I calculate the failure percentage in data table in kibana ?
I have 3 columns like total ,success , failure nd I need to calculate the failure percentage which is ( failure / total ) ×100 . Is there any possible way to calculate it in data table
You would do this using scripted fields for versions below 7.14 or runtime fields for 7.14 and later.
As I'm new with kibana can you please help me with the scripted fields
Index Management -> Index Patterns -> Open your index pattern -> Scripted Fields Tab -> Add Scripted Field
Name your field
Set type as number
For the script you would use something like the below.
double result = (doc['failure'].value / doc['total'].value) * 100;
return result;
if you're on 7.14 or later you can maybe do this in custom formula in lens tables. (sum(failure) / sum(total)) * 100
(screenshots below)
there's this ratios example in this blog that does something similar with filtering (if you don't have a failure count if your document)
I'm using kibana 7.10.2 version
The KQL query for failure is 'NOT statusCode:200'
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.