Splunk Search

count(failure) is returning 0 always

Jiten009
Explorer

Hi,

I am trying to find the count of total failure to calculate the failure percentage.

| stats count(eval(eventtype="failure")) AS Failed

OR

| stats count("failure") AS Failed

In both the cases its always returning 0, whereas I have failure status count is 300 in my logs.

Please help me out in resolving this.

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

The first stats is correct, provided you have a field named eventtype that occasionally has the value "failure".

As a different approach, try top eventtype instead of stats count.

View solution in original post

0 Karma

lguinn2
Legend

This will avoid the problem of case-sensitivity:

<yourbasesearch>  eventtype="failure" | stats count

And it is probably more efficient. You should try to eliminate as many events as possible in the initial search.

BTW, search is case-insensitive for values, and that includes field values. But the stats command and the eval function are case-sensitive.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

The first stats is correct, provided you have a field named eventtype that occasionally has the value "failure".

As a different approach, try top eventtype instead of stats count.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Was just about to post that 🙂

0 Karma

Jiten009
Explorer

ya, got it the keyword 'Failure' in search is case sensitive.

0 Karma

Jiten009
Explorer

yes, I have a field in my log with name eventtype which has value failure i.e host=168.94.64.138,eventtype=Failure,facetFieldPrefix="1

Thanks for your reply.

0 Karma
Get Updates on the Splunk Community!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...