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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

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 ...