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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...