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