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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...