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!

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!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...