Splunk Search

How to search keywords to identify in a field using regex?

sathiyasun
Explorer

How to match keywords to identify in a field using regex.

Our requirement is to capture the keywords that are (Liquor OR Casino OR Gambling OR Adult) which comes in a field.

somesoni2
SplunkTrust
SplunkTrust

Try this. To extract a new field with the keyword and filter events where these keywords are present

index=foo sourcetype=bar (Liquor OR Casino OR Gambling OR Adult) | rex field=_raw "(?<somefield>(Liquor|Casino|Gambling|Adult))"
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...