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!

Index This | What did the zero say to the eight?

June 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Now Playing: Splunk Education Summer Learning Premieres

It’s premiere season, and Splunk Education is rolling out new releases you won’t want to miss. Whether you’re ...