Splunk Search

Count as a limiting factor for results of a nested query?

fncds3
Explorer

I'm attempting to identify the top 5 hosts responsible for my errors via the following query:

sourcetype=logs 
[ search sourcetype=logs 
| top 0 errors showperc=false showcount=false ] 
| top 5 hosts by errors showperc=false

This query works, but gives me results for a ton of errors. I would like to limit the results to only errors per host that are greater than a count of 10. However when I add the following line to my query, I get no results:

| search count > 10

I know that I have results that are > 10, so this logic is valid, but I cannot figure out how to properly apply it.

Here's a sample of what my results look like:

 - host  - error - count 
 - APP01 - err09 - 50 
 - APP01 - err07 - 38 
 - APP01 - err05 - 27 
 - APP01 - err10 - 20 
 - APP01 - err12 - 4 
 - APP02 - err15 - 33 
 - APP02 - err60 - 21 
 - APP02 - err09 - 8

...

Any ideas on how to remove the rows with counts that are not greater than 10?

Tags (2)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

Why the subsearch?

sourcetype=logs | stats c by error, host | search c > 10

Perhaps there is some simplification you've made regarding the actual logs. If this does not work, please post a few sample lines of actual log.

hope this helps,

Kristian

View solution in original post

kristian_kolb
Ultra Champion

Why the subsearch?

sourcetype=logs | stats c by error, host | search c > 10

Perhaps there is some simplification you've made regarding the actual logs. If this does not work, please post a few sample lines of actual log.

hope this helps,

Kristian

Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...