Splunk Search

lookup two csv pattern match query

surekhasplunk
Communicator

I have a requirement like this

from file1.csv lookup file i am getting 2 fields
field1 field2


"application support" 1

"technology maintenance" 3
"enterprise platform" 4

file2.csv file has many fields out of which one of the field name field3 has data like this

filed3

"application file"
"cto maintenance"
"application file"
"application file"
"application file"
"enterprise security"
"enterprise security"

Now if field1="application support" search for word "application" in file2.csv in field3 And since we got a pattern match for word application now i need the count saying how many "application file" values are there in field3 of file2.csv and get the resulting table as below.

field1 field2 field3


"application support" 1 4
"technology maintenance" 3 1
"enterprise platform" 4 2

Tags (2)
0 Karma
1 Solution

anjambha
Communicator

Hello,

try this..

| inputlookup file1 | join type=outer field1 [| inputlookup file2 | eval field1=case(field3 == "application file", "application support", field3 == "cto maintenance", "technology maintenance") | stats count by field1] | table field1 field2 count

View solution in original post

anjambha
Communicator

Hello,

try this..

| inputlookup file1 | join type=outer field1 [| inputlookup file2 | eval field1=case(field3 == "application file", "application support", field3 == "cto maintenance", "technology maintenance") | stats count by field1] | table field1 field2 count

surekhasplunk
Communicator

Thank you very much @anjambha it worked

0 Karma

elliotproebstel
Champion

Couple of questions:
(1) Is this something you're doing once and could handle a multi-step process, or something you want to run over and over?
(2) How many entries are in file1? A small handful, or a very long list?
(3) In all of your examples, the position of the word in field1 from file1.csv matches the position of matching words in field3. For example, "application support" matches against "application file" - would it also match against "file application" if such an entry existed in field3?

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

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...