Splunk Search

How to show only certain values in a chart

acontarciego
Explorer

I have a search that get code values:
How can I show only the count of 4 values in a chart and have the rest reported as "OTHER".

Tags (1)
0 Karma

Ayn
Legend
... | top 4 yourfield useother=t
0 Karma

acontarciego
Explorer

One more twist. How do I show this in a time chart?

0 Karma

Ayn
Legend

Ah, that's a bit trickier. This is the solution I can think of right now - possibly there's a 'neater' solution, but if there is one I'll have to sleep on it. 🙂

... | stats count(eval(yourfield=="value1")) as value1, count(eval(yourfield=="value2")) as value2, count(eval(yourfield=="value3")) as value3, count(eval(yourfield=="value4")) as value4, count(eval(match(yourfield,"value1|value2|value3|value4"))) as OTHER | transpose
0 Karma

acontarciego
Explorer

Thanks, Ayn.
That works if I want the top 4 values. I forgot to mention that the 4 values I want will not necessarily by the top 4 by count.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...