Splunk Enterprise

How to use eval command to determine if there is more than one value in a stats table field?

dwcooley01
Engager

Hello Everyone. I'm trying to find a way to use the eval command to determine whether or not a field in my stats table has more than one value.  Here is the scenario......I have two columns - IP Address in column A and userID in column B. The userID field may have more than one value. I'd like to evaluate the UserID field in each line to determine if there is more than one UserID listed. If there is, I'd like the eval command to place a value of 1 in column C, and if only one userID, to place a value of 0 in column C. Any help would be very appreciated.

Thanks!

Labels (1)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use the mvcount function to find out how many values are in a multi-value field.

| eval columnC = if(mvcount(userID)=1, 0, 1)

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Use the mvcount function to find out how many values are in a multi-value field.

| eval columnC = if(mvcount(userID)=1, 0, 1)

 

---
If this reply helps you, Karma would be appreciated.

dwcooley01
Engager

Perfect. Thanks for the reply.

0 Karma
Get Updates on the Splunk Community!

Splunk Training for All: Meet Aspiring Cybersecurity Analyst, Marc Alicea

Splunk Education believes in the value of training and certification in today’s rapidly-changing data-driven ...

Investigate Security and Threat Detection with VirusTotal and Splunk Integration

As security threats and their complexities surge, security analysts deal with increased challenges and ...

Observability Highlights | January 2023 Newsletter

 January 2023New Product Releases Splunk Network Explorer for Infrastructure MonitoringSplunk unveils Network ...