Knowledge Management

Regex needed for sourcetype forcing

maria1991
Explorer

Hi All

I have a sourcetype in which we have some events with a keyword like asdf. In some events it comes in between and some events at the end.

I need to forward all these logs to another sourcetype with props and transforms.

[generic_sourcetype_routing_asdf]
REGEX = 
DEST_KEY = MetaData:Sourcetype
FORMAT = sourcetype::asdf_logs

props.conf

[current_sourcetype]
TRANSFORMS-sourcetype_routing = generic_sourcetype_routing_asdf

In the REGEX part I would like to know if only keeping asdf or *asdf * would work. I can't put the regex for complete log format since there are multiple formats. So I need to inform splunk to pass any event with asdf anywhere in it should be forwarded to the new one. Please suggest.

Thanks

Maria Arokiaraj

 

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

*asdf* is not a valid regular expression.  Use asdf.  There is an implied wildcard at the beginning and end of every regex unless specified otherwise with ^ and/or $.

regex101.com is a great place to test expressions.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

maria1991
Explorer

Just adding the keyword asdf worked for me 🙂 Thanks

0 Karma

richgalloway
SplunkTrust
SplunkTrust

*asdf* is not a valid regular expression.  Use asdf.  There is an implied wildcard at the beginning and end of every regex unless specified otherwise with ^ and/or $.

regex101.com is a great place to test expressions.

---
If this reply helps you, Karma would be appreciated.
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!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...