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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...