Splunk Search

How do I search and compare fields from two different CSV files?

tp92222
Explorer

I have two CSV files: dummy1 dummy2

dummy1 contains

server ip    apps running
10.1.1.1     Firefox, oracle, skypee
10.2.2.2     outlook, chrome
10.2.1.1     Firefox, msoffice

dummy2 contains

Vulnerability_id    apps affected
1                   Firefox,chrome
2                   Skype

This is my expected output:

server ip     vern_apps         vern_id
10.1.1.1      Firefox,skype     1,2
10.2.2.2      skype             2
0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this

| inputlookup dummy1.csv | makemv app_running delim="," | mvexpand app_running | rename app_running as app | join type=inner app [| inputlookup dummy2.csv | makemv app_affected delim="," | mvexpand app_affected | rename app_affected as app ] | table server_ip apps Vulnerability_id 

View solution in original post

0 Karma

lguinn2
Legend

Assuming that the field names are "server ip","apps running",Vulnerability_id, and "apps affected"
Try this

source=dummy2
| eval applist=`apps affected`
| makemv  delim="," applist
| mvexpand applist
| eval appname=applist
| join appname max=0 [ search source=dummy1
        | eval  applist=`apps running`
        | makemv  delim="," applist
        | mvexpand applist
        | eval appname=applist ]
| stats count(Vulnerability_id) as count list(Vulnerability_id) list("apps running" ) by "server ip"
| where count > 0
0 Karma

somesoni2
Revered Legend

Try something like this

| inputlookup dummy1.csv | makemv app_running delim="," | mvexpand app_running | rename app_running as app | join type=inner app [| inputlookup dummy2.csv | makemv app_affected delim="," | mvexpand app_affected | rename app_affected as app ] | table server_ip apps Vulnerability_id 
0 Karma

tp92222
Explorer

Thank you. query solved my problem

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...