Dashboards & Visualizations

How to get the no of rows in a table without count field

AdixitSplunk
Path Finder

Hi ,
Please help me with the below format for a splunk query .I want a result like below :

host Message

x ABC
y DEF
z HIG
Total 3
My basic search is like: index=xyz sourcetype=123 Message ="*"|stat count by host Message

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

index=xyz sourcetype=123 Message ="*" | stats count by host Message | fields - count | appendpipe [|stats count as Message | eval host="Total"]

View solution in original post

niketn
Legend

A little different approach which will print row numbers against each row, but without nested Splunk search query, hence should not cause performance issue.

index=xyz sourcetype=123 Message ="*"
| stat count by host Message 
| fields - count

Save as dashboard table and set the table properties to enable Row Numbers. You can do the same by editing Dashboard XML also.

<option name="rowNumbers">true</option>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

chimell
Motivator

Hi

Try this search code :

index=xyz  sourcetype=123  Message ="*"|stats count by host  , Message |fields - count |appendcols[search index=xyz  sourcetype=123  Message ="*"|stats count as Total  ]
0 Karma

somesoni2
Revered Legend

Try like this

index=xyz sourcetype=123 Message ="*" | stats count by host Message | fields - count | appendpipe [|stats count as Message | eval host="Total"]
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...