Splunk Search

Add an incremental number field in search output

sympatiko
Communicator

HI,

I just want to ask if it's possible to have an incremental number in my output table in splunk search? Example:

Index=a dstip="*" | top limit=20 dstip

dstip percent

1 dstip1 100
2 dstip2 99
..
..

Originally the output has no # fields. Is possible to add that in my search command?

Thanks,

Tags (2)

lguinn2
Legend

Try this

index=a dstip="*" 
| top limit=20 dstip showcount=f
| eval counter=1
| accum counter as LineNumber
| fields - counter
| table LineNumber dstip percent

sympatiko
Communicator

Hi Iguinn,

Thanks for your help. If I put the LineNumber on the on the last statement like this "table LineNumber dstip percent" no value on the LineNumber field is being displayed but when I search like this "table dstip percent LineNumber" it has a value.

Thanks you

0 Karma
Get Updates on the Splunk Community!

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

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...