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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...