Splunk Search

Display row numbers in output

efelder0
Communicator

I am indexing a CSV file into Splunk and wish to display the row number in a seperate column called 'row count'.

Example:

Field 1 Field 2 Row Count Field 3
blah blah 1 blah
blah blah 2 blah
blah blah 3 blah

What is the best method to achieve this?

Thanks.

Tags (2)

sanderdenheijer
Explorer

Add ... | streamstats count as "Row Count" to your search

efelder0
Communicator

Would displayRowNumbers work here? If so, how would it be configured in my search query?

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi efelder0,

you can set this in viewstates.conf or in your XML with this option:

<option name="displayRowNumbers">true</option>

This will work in the recent Splunk releases.

0 Karma

wrangler2x
Motivator

Adding to /opt/splunk/etc/apps/search/local/viewstates.conf does not seem to do anything in the search app.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...