Splunk Search

Is there a search or command that will number rows in a table?

ThiruSplunk5676
New Member

is there any command to get row numbers in table?

Like,
I have a table like

host   source type
DFR    splunk_id
FGH    splunkd
THG    splunk_ui

i would like to have like:

NO  host   source type
1   DFR    splunk_id
2   FGH    splunkd
3   THG    splunk_ui
0 Karma
1 Solution

somesoni2
Revered Legend

You can try these.

your current search | eval NO=1 | accum NO

or

your current search | streamstats count as NO

View solution in original post

msivill_splunk
Splunk Employee
Splunk Employee

streamstats might be worth considering. Below is a standalone example.

| makeresults count=3 | streamstats count

In your case just pipe the query to streamstats

.. | streamstats count
0 Karma

ThiruSplunk5676
New Member

Thank you so much, it works

0 Karma

somesoni2
Revered Legend

You can try these.

your current search | eval NO=1 | accum NO

or

your current search | streamstats count as NO
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...