Splunk Search

Report showing the position of an event within a set of event results

maverick
Splunk Employee
Splunk Employee

Is there a way to report on the position of an event relative to the rest of the events in the result set?

For example, if I have five events in my result set, is there a way to display each event along with the position number relative in time to the other events, kind of like showing the ordering or row number?

Like this:

User     Row_Position
----     ------------
Eric     1
Greg     2
Gerald   3
Ledio    4
Mick     5

where the event containing the User=Eric is the earliest in time, the one with User=Greg is second one in time after that one, the event with User=Gerald is the next event in time after that one, etc.

BTW, when I create a table with my search, I notice a grayed-out row number on the far left side of the table in the search results page. Can I reference that? If so, what is the name of that field?

0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

When viewing returned events (but not results) there is a field _serial that is returned with each event. The field is the zero-based index of the event within the original set of returned events (before other commands are run against the set).

Results, which are the results of stats, chart, or timechart commands will not have such a field, as those will only have the fields you are summarizing. You could add such a field once your results are complete with | eval c=1 | accum c or | streamstats count as c commands though.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

When viewing returned events (but not results) there is a field _serial that is returned with each event. The field is the zero-based index of the event within the original set of returned events (before other commands are run against the set).

Results, which are the results of stats, chart, or timechart commands will not have such a field, as those will only have the fields you are summarizing. You could add such a field once your results are complete with | eval c=1 | accum c or | streamstats count as c commands though.

maverick
Splunk Employee
Splunk Employee

Cool. The accum command did the trick. Exactly what I needed. Thanks!

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