Splunk Search

How do I exclude fields with certain values from a table when the event has multiple values for the same fields?

ZacEsa
Communicator

Hi,

As the title says. Refer to the screenshot below too;

The event
The above is the log for the event. as you can see, there are multiple indicatorName in a single event.

The table
And this is the table when I do a top. However, I only want certain values to show. E.g. Only show indicatorName: DETECTED_MALWARE_APP and not indicatorName: CODE_DROP.

0 Karma
1 Solution

DalJeanis
Legend

If you are trying to eliminate just the words from the multivalue field, then use mvfilter().

| eval Indicator=mvfilter(NOT match(Indicator,"^(POLICY_TERMINATE|MALWARE_DROP)$"))

The doc is on this page...

http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/MultivalueEvalFunctions

And here are a couple of related answers...

https://answers.splunk.com/answers/13382/removing-some-field-values-from-a-mulitiple-value-field.htm...

https://answers.splunk.com/answers/346961/remove-multiple-values-from-a-multi-value-field.html

View solution in original post

DalJeanis
Legend

If you are trying to eliminate just the words from the multivalue field, then use mvfilter().

| eval Indicator=mvfilter(NOT match(Indicator,"^(POLICY_TERMINATE|MALWARE_DROP)$"))

The doc is on this page...

http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/MultivalueEvalFunctions

And here are a couple of related answers...

https://answers.splunk.com/answers/13382/removing-some-field-values-from-a-mulitiple-value-field.htm...

https://answers.splunk.com/answers/346961/remove-multiple-values-from-a-multi-value-field.html

ZacEsa
Communicator

I tried it with eval threatInfo.indicators{}.indicatorName=mvfilter(match(threatInfo.indicators{}.indicatorName, "DETECTED_MALWARE_APP")) but it's throwing Error in 'eval' command: The expression is malformed. Expected ).

0 Karma

ZacEsa
Communicator

Nevermind, found out the issue. Splunk doesn't like it when my field name is threatInfo.indicators{}.indicatorName. Had to rename it to something else and then it worked. Thank you! Will mark your answer as correct now.

0 Karma
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...