Splunk Search

How to find certain field values and change the value into another field

ajdyer2000
Path Finder

If the vulnerability column has a certain value then a new column called ‘Software_Affected’ has a corresponding value like below--

  1. DES” is in the vulnerability column then the new ‘Software Affected’ column value is “3DES”
  2. 7-Zip” is in the vulnerability column then the new ‘Software Affected’ column value is “7-Zip”
  3. Acrobat”is in the vulnerability column then the new ‘Software Affected’ column value is “Adobe Acrobat”
  4. Flash” is in the vulnerability column then the new ‘Software Affected column value is “Adobe Flash”

Thanks for your help. This is the best forum !!!
Alan

0 Karma

solarboyz1
Builder
| eval "Software Affected"=case(match(vulnerability,"*Flash*"),"Adobe Flash", match(vulnerability,"*Acrobat*"),"Adobe Acrobat",match(vulnerability,"*7-Zip*"),"7-Zip",match(vulnerability,"*DES*"),"3DES","Unknown")

If you have a large number so that using case isnt efficient, then using a lookup as @diogofgm recommends:

| lookup yourlist vulnerability OUTPUT Software_Affected 
0 Karma

Sukisen1981
Champion

from where do you get 3DES in the first sample and how do you add adobe to the last?

0 Karma

diogofgm
SplunkTrust
SplunkTrust

You can use a lookup configured to use wildcards

create your lookup like this
"vulnerability","software_affected"
Flash”,“Adobe Flash”
etc

and then follow the steps in this answer
https://answers.splunk.com/answers/52580/can-we-use-wildcard-characters-in-a-lookup-table.html

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...