Splunk Search

How to increment counter field with a by clause

e_sherlock
Explorer

Given events

Group MultiValue

A 7,2,9

B 8,1

I'm using makemv to pivot the results to below, but I also want a new Index/Counter field which counts (or shows the index value) and resets when it sees a new group. The accum command doesn't support a "by [field list]" so curious how to do this?

Group Value **Index/Counter**


A 7 1

A 2 2

A 9 3

B 8 1

B 1 2

Tags (3)
1 Solution

e_sherlock
Explorer

Got it working like this:

| streamstats count as index by Group

View solution in original post

e_sherlock
Explorer

Got it working like this:

| streamstats count as index by Group

sloshburch
Splunk Employee
Splunk Employee

Or just | stats count as index by Group should work I assume.

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