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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...