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!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...