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
Revered Legend

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
Revered Legend

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!

Buttercup Games: Further Dashboarding Techniques (Part 6)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Splunk Observability Synthetic Monitoring - Resolved Incident on Detector Alerts

We’ve discovered a bug that affected the auto-clear of Synthetic Detectors in the Splunk Synthetic Monitoring ...