Splunk Search

How to join 2 CSV files that have unique values in single table?

krishnacasso
Path Finder

Fields in first.csv file: DN, uidn, count, Status, TimeStamp
Fields in second.csv file: DN, uidn, AppID, eid, user, eStatus, Timestamp
DN value is different in both the tables, so I want to rename as DN2 and show it on a table.
Both the CSV files have unique uidn values. I want to create a single table joining all the fields,

Table:
uidn,DN,DN2,count,Status,TimeStamp,eid,user

Thanks.

0 Karma

cmerriman
Super Champion

Is the join on uidn and timestamp?

|inputlook first.csv |join uidn timestamp [|inputlookup second.csv|rename DN as DN2]
0 Karma

lguinn2
Legend

This should work

source=csv1 OR source=csv2
| eval DN2 = if(source=="csv2",DN,null())
| eval DN = if(source=="csv1",DN,null())
| stats list(DN) as DN, list(DN2) as DN2, count, list(Status) as Status, 
     list(TimeStamp) as TimeStamp, list(eid) as eid, list(user) as user by uidn

Or if you really want "all fields"

source=csv1 OR source=csv2
| eval DN2 = if(source=="csv2",DN,null())
| eval DN = if(source=="csv1",DN,null())
| stats list(*) as * by uidn
0 Karma
Get Updates on the Splunk Community!

Deep Dive into Federated Analytics: Unlocking the Full Power of Your Security Data

In today’s complex digital landscape, security teams face increasing pressure to protect sprawling data across ...

Your summer travels continue with new course releases

Summer in the Northern hemisphere is in full swing, and is often a time to travel and explore. If your summer ...

From Alert to Resolution: How Splunk Observability Helps SREs Navigate Critical ...

It's 3:17 AM, and your phone buzzes with an urgent alert. Wire transfer processing times have spiked, and ...