Splunk Search

How do you build a list of unique items in a field?

Marinus
Communicator

I'd like to build up a list of unique user id's that call a service.
If I use eval to just concatenate the next user id, I'd end up with duplicates.

eval userids=userid+","+userid
Tags (2)
0 Karma
1 Solution

ziegfried
Influencer

You could use multivalue fields:

 ... | stats values(userid) as userids | eval userids=mvjoin(userids,",")

View solution in original post

0 Karma

ziegfried
Influencer

You could use multivalue fields:

 ... | stats values(userid) as userids | eval userids=mvjoin(userids,",")
0 Karma

Marinus
Communicator

I ended up using eventstats rather than stats, thanks Ziegfried!

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...