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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...