Splunk Search

Percentages in Search Query

sandyrite87
Loves-to-Learn

I'm having trouble formulating a search query for the following data:

When the number of "tests-failed" has exceeded 20% of "tests-total".

How do you do percentages?

P.S. i'm working with metrics data.

Tags (2)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Use eval

 

| eval percent=round(testsfailed/teststotal*100,2)

Assuming your field names are as above. If you want to use 'tests-failed' and 'tests-total' then you need to wrap those field names in single quotes in the eval statement.

 

 

0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...