Splunk Search

In a stats based on the item selected in the drop down, how can I display two columns in the panel which display the count when Id=* and when Id=number?

macadminrohit
Contributor

Hi,

I have a query which does the stats count by ID selected through the drop-down query looks like :

index=servers sourcetype=json Id=* msg="method" OR "disabled" earliest=-60m@m latest=now  | stats count as cnt by _time,msg, Id | head limit=20

I want to display two columns in the panel which display the count when Id=* and when Id=number respectively. Where a number can be any choice from the drop-down.

0 Karma

somesoni2
Revered Legend

Assuming you're using the Id dropdown token as $id$ in the base search, try like this. This will show id=*on all rows if the Id selected from dropdown was * (all Ids) ,will show Id=selectedId otherwise.

index=servers sourcetype=json Id="$id$" msg="method" OR "disabled" earliest=-60m@m latest=now | eval Id=if("$id$"="*","*",id) | stats count as cnt by _time,msg, Id | head limit=20
0 Karma

macadminrohit
Contributor

Thanks, I was thinking to do the same thing but it is displaying * under the column Id.

0 Karma
Get Updates on the Splunk Community!

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

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...