Splunk Search

How to match string in multi value field?

james_n
Path Finder

Hi experts,

I have a filed called names as shown below, if i search with first line of strings then search returning the complete filed event but not second and third line of filed strings. I used | eval names= mvfilter(names="32") and also | eval names= mvfilter(match("32", names)) but not worked for me. Please help me on this, Thanks in advance.

names
1121 - sample name
3247 - sample names
9876 - simple name

required out put: if I search with names=1121* or names=3247* or names=9876* then complete event has to be returned.i,e as i shown above.

Labels (1)
0 Karma

Senak
Loves-to-Learn

Hi,

Your match() syntax in just not good.
It should be 

 

 | eval names= mvfilter(match(names,"32"))

 

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

I think mvfind may help you.

| eval names = if ( isnull ( mvfind ( names, "32" ) ), null, names )
---
If this reply helps you, Karma would be appreciated.

james_n
Path Finder

@richgalloway thanks for the quick response, its working fine but above mentioned value(32) comes from drop down using token, the problem is when i select any value in the drop down list its working fine but if i select * which is default value of that drop down at that time shown an error. plz help on this, once again thanks.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The second argument to mvfind (and match) must be a valid regular expression. * is not valid, but .* is. Try that.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...