Splunk Search

How to generate a search that will filter data from a CSV file?

laudai
Path Finder

hi guys I'm new to Splunk

I have two csv files: A and B
A has name, ages, height, weight
B is the limitation factor for A file, it's has name, ages, height, weight too.

how can I list :

where a.name = b.name AND a.ages >b.ages AND a.height < b.height AND a.weight < b.weight

Thank you for your answer.

0 Karma
1 Solution

DalJeanis
SplunkTrust
SplunkTrust
| inputcsv a.csv 
| rename ages as agesA, height as heightA, weight as weightA 
| table name agesA heightA weightA
| join type=left 
   [inputcsv b.csv 
    | rename ages as agesB, height as heightB, weight as weightB 
    | table name agesB heightB weightB] 
| where agesA>agesB AND heightA<heightB AND weightA<weightB

The renames are not both necessary, but it clarifies which field is which for you.

You could also use a lookup instead of a join, but this one will work fine.

View solution in original post

DalJeanis
SplunkTrust
SplunkTrust
| inputcsv a.csv 
| rename ages as agesA, height as heightA, weight as weightA 
| table name agesA heightA weightA
| join type=left 
   [inputcsv b.csv 
    | rename ages as agesB, height as heightB, weight as weightB 
    | table name agesB heightB weightB] 
| where agesA>agesB AND heightA<heightB AND weightA<weightB

The renames are not both necessary, but it clarifies which field is which for you.

You could also use a lookup instead of a join, but this one will work fine.

laudai
Path Finder

Thank you for your answer.

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...