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!

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...