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!

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