Splunk Search

Remove multiple values from a multi-value field

landen99
Motivator

I would like to remove multiple values from a multi-value field.

Example:

field_multivalue = pink,fluffy,unicorns

Remove pink and fluffy so that:

field_multivalue = unicorns

I am thinking maybe:

| stats values(field1) AS field_multivalue by field2 | mvfilter

OR

| stats values(field1) AS field_multivalue by field2  | mvexpand field_multivalue | search field_multivalue!="pink" field_multivalue!="fluffy" | mvcombine field_multivalue 

How would you recommend doing this? The list of values to filter out is over a dozen.

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

I would use mvfilter, specially in the cases where patterns to be filtered is small and entities in mv field is high. Like this

| gentimes start=-1 | eval field1="pink,fluffy,unicorns" | table field1 | makemv field1 delim="," | eval field1_filtered=mvfilter(NOT match(field1,"pink") AND NOT match(field1,"fluffy"))

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

I would use mvfilter, specially in the cases where patterns to be filtered is small and entities in mv field is high. Like this

| gentimes start=-1 | eval field1="pink,fluffy,unicorns" | table field1 | makemv field1 delim="," | eval field1_filtered=mvfilter(NOT match(field1,"pink") AND NOT match(field1,"fluffy"))
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...