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
Revered Legend

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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...