Dashboards & Visualizations

How to remove top result or keyword from showing in searh

soulmaker
Explorer

Hi there, I have this query below to search the top policies that has been used. 

 

type="request" "request.path"="prod/" | stats count by policies{} | sort  -count  | head 10

 

by default all the policies is being generated with "default" which I wanted to get rid of when searching so properly shows the top 10 policies only. 

The search query above example results are:

 

policies:
default
policies_1
policies_2
policies_3
....

 

I wanted to get rid of the default showing on my result. Any idea or help is really appricated. 

Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

As your policies JSON looks like it's an array, if you are saying that all events will have a 'default' policy as well as another policy, then this should work

type="request" "request.path"="prod/" 
| stats count by policies{} 
| sort  -count  
| where 'policies{}' != "default"
| head 10

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

As your policies JSON looks like it's an array, if you are saying that all events will have a 'default' policy as well as another policy, then this should work

type="request" "request.path"="prod/" 
| stats count by policies{} 
| sort  -count  
| where 'policies{}' != "default"
| head 10

 

soulmaker
Explorer

Awesome, this works as well. Thanks again for your help on this one. 

0 Karma
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 ...