Splunk Search

How to do a top limit on a table after a transaction search?

bmo017
Path Finder

Hello,

I am trying to do a search to have a table display each country, and then from that, show the top three Services Ran. I am stumped with how to limit the ServiceRan column to only show the top three for each country without messing it up.

sourcetype= action=X| transaction country| table country,serviceRan

Currently with this search it outputs a table and displays two columns one being the country with one value, and another being the serviceRan with anywhere from 1 to 10 values for each country. Again, I would like to limit the serviceRan to only showing the top 3 results for that particular country.

0 Karma
1 Solution

sundareshr
Legend

Try this approach instead

sourcetype= action=X | streamstats count by country | where count<=3 | table  country serviceRan

*OR*

sourcetype= action=X | streamstats count by country | where count<=3 | stats values(serviceRan) as serviceRan by country

View solution in original post

0 Karma

sundareshr
Legend

Try this approach instead

sourcetype= action=X | streamstats count by country | where count<=3 | table  country serviceRan

*OR*

sourcetype= action=X | streamstats count by country | where count<=3 | stats values(serviceRan) as serviceRan by country
0 Karma

bmo017
Path Finder

Perfect thank you, the second one worked perfect!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

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, ...