Splunk Search

How to combine the results of searches from two CSV files?

ibmrakesh
Explorer

Hi All,
I am new to Splunk world, Please help me to explore.

I have two CSV files let's say

table_1.csv with fields 'Bus No', 'Booking ID', 'start Time', 'End Time', 'Source', 'Destination'
table_2.csv with fields 'Bus No', 'Booking ID', 'Via','Halting Timings','Passenger counts', 'Failures', etcs.

I need to somehow join the two csv files to get the details i.e 'Bus No', 'Booking ID', 'Passenger counts', 'Failures', 'start Time', 'End Time', 'Source', 'Destination' but the condition is like below.
If there are any failures ( i.e failures > 0 ) in table_2.csv file, then get the 'Bus No', 'Booking ID' from the table_2.csv file and match with the 'Bus No', 'Booking ID' field in table_1.csv. If it is there, then get the information of 'Bus No', 'Booking ID', 'Passenger counts', 'Failures', 'start Time', 'End Time', 'Source', 'Destination' in output.

Thanks In Adv.

0 Karma

somesoni2
Revered Legend

Assuming the csv data is indexed in Splunk, give this a try

index=foo sourcetype=bar (source=*table_1.csv OR source=*table_2.csv)
| table "Bus No" "Booking ID" "start Time" "End Time" "Source" "Destination" "Via" "Halting Timings" "Passenger counts" "Failures"
| stats values(*) as * by  "Bus No" "Booking ID" | where 'Failures'>0
0 Karma

ibmrakesh
Explorer

@somesoni2: Thanks for the response. As I am a beginner can you please help me how to create a index in my scenario, I mean how to change the inputs.conf and props.conf files based on this scenario.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...