Splunk Search

Returning the value and position of items in a multivalue field

dcparker
Path Finder

Hello,
I have a field a:
1039275019, 138262333, 20232307, 175653, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

I would like to return a table with the index and value of each item. For example:
1 1039275019
2 138262333
3 20232307
4 20232307
5 175653

and etc.

Can anyone help with this? If you wondering, the field is coming from cassandra via jmx, so I don't have tons of control over it.

thanks!

1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try this.

<your base search giving field say myfield> | eval myfield=split(myfield,",") | mvexpand myfield | eval sno=1 | accum sno

OR

<your base search giving field say myfield> | eval myfield=split(myfield,",") | mvexpand myfield | streamstats count as sno

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try this.

<your base search giving field say myfield> | eval myfield=split(myfield,",") | mvexpand myfield | eval sno=1 | accum sno

OR

<your base search giving field say myfield> | eval myfield=split(myfield,",") | mvexpand myfield | streamstats count as sno

dcparker
Path Finder

thanks, that works!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

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