Splunk Search

How to choose one field value out of two ?

rakeshksingh
New Member

Hi All,

If a field has two values but I want to pick only one. Could you please suggest me with the help of which command I can do that ?

just as say
Field A= B,C

0 Karma

cpetterborg
SplunkTrust
SplunkTrust

Try something like this:

| makeresults | eval _raw="A=B,C" | rex "A=(?P<val>\S+)" | makemv delim="," val | eval choice=mvindex(val,1), not=mvindex(val,0)

You will have to provide your search, but the use of mvindex is what you want to see.

Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...