Splunk Search

Search for a pattern in a lookup CSV file which is received from first search from another lookup CSV file

surekhasplunk
Communicator

I have two lookup csv files.
file1.csv and file2.csv

1st query results me with field1 which has a pattern match in field2 of file2.csv not the exact match.

how can i achieve this in query .

Thanks

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi surekhasplunk,
try something like this:

| inputlookup file1.csv
| search [ | inputlookup file2.csv | eval field1="*"+field2+"*" | fields field1 ]
| table .....

Bye.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi surekhasplunk,
try something like this:

| inputlookup file1.csv
| search [ | inputlookup file2.csv | eval field1="*"+field2+"*" | fields field1 ]
| table .....

Bye.
Giuseppe

0 Karma

surekhasplunk
Communicator

thanks @cusello,

It worked well with the numeric field data but somehow returning 0 results for character fields.
i have something filed1 value from file1.csv which looks like "APPLICATION SUPP" and i have
field2 value from file2.csv which looks like "Application Support"
so am doing a
| inputlookup file1.csv | eval a1=substr(field1,13,3) | eval a1=lower(a1)
| search [ | inputlookup file2.csv |eval a1=substr(field1,13,3)| eval b1=""+a1+""| eval field1=""+b1+"" | fields field1 ]
| table .....

but getting 0 rows returned

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...