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

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

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 | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...