Splunk Search

How to combine two csv?

siva_1
New Member

Hi All,

I have two csv files. 

File1.csv -> id, operation_name, session_id

File2.csv -> id, error, operation_name

I want to list the entries based on session_id like ->id, operation_name, session_id, error. Basically all the entries from file1.csv for the session_id and errors from file2.csv. 

Could you please help how to combine these csv?

Note: I am storing the data to CSV as a output lookup since I couldn't find a way to search these via single query. So trying to join from csv.

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

session_id doesn't appear to exist in both look ups so you won't be able to "join" using that. If you mean you want to "join" by id, then a simple lookup should work

| inputlookup File1.csv
| lookup File2.csv id

Alternatively, if you want to use both the id and operation name you could try something like this

| inputlookup File1.csv
| lookup File2.csv id operation _name
0 Karma

siva_1
New Member

@ITWhisperer File1.csv has the session_id.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Exactly! So how do you match entries in File2.csv?

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