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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...