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!

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