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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...