Splunk Search

how to search multiple patterns in named group

abhayneilam
Contributor

I am using the following command to search :

index="real" | rex field="Location" (?mumbai)

can anyone tell me how do i search multiple value like : here m searching for "mumbai" but if I would also like to search for "delhi" and "kol" then what i have to write ...

Please help me !!

Thanks
Abhay

Tags (5)
0 Karma

MarioM
Motivator

wouldn't it be easier to do ?

index="real" Location="*mumbai*"

index="real" Location="*delhi*"

index="real" Location="*kol*"

OR if you dont have many values

index="real" | rex field="Location" (?<target>(mumbai|delhi|kol)) | search target=mumbai
0 Karma

abhayneilam
Contributor

but my output should come like this :

Name,age,company,target
xyz,45,kolkata,kolkata
xyz,45,kolkata is a mumbai,kolkata mumbai
xyz,45,ludhiaya
xyz,45,delhi, delhi

xyz,45,bangalore

"target" will be added as a last column and the matched keywords will be the value

Please help

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 ...