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!

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