Getting Data In

How come my regexes aren't working in props source matching?

krisreeves
Path Finder

Splunk Enterprise 6.5.4, with dedicated indexer and search head clusters, using config such as this:

transforms.conf:

[set_configured_sourcetype]
REGEX      = .
FORMAT     = sourcetype_configured::1
WRITE_META = true

fields.conf:

[sourcetype_configured]
INDEXED=true

props.conf:

[source::/path/(foo|bar).log]
priority = 100
TRANSFORMS-setconfigured = set_configured_sourcetype

Data from foo.log and bar.log do not have sourcetype_configured=1 on them

However, with props.conf:

[source::/path/foo.log]
priority = 100
TRANSFORMS-setconfigured = set_configured_sourcetype

[source::/path/bar.log]
priority = 100
TRANSFORMS-setconfigured = set_configured_sourcetype

Things behave as expected. Is there any explanation for this behavior? Other Splunk Answers posts, the docs seem to indicate that regular expressions should be acceptable in this context, and the priority setting should ensure that these stanzas aren't superseded by something else alphabetically.

1 Solution

whrg
Motivator

I had a similar issue once. I found out that regular expressions are not fully supported in stanzas.

However, I got it working like this:

[source::/path/(foo|bar)*.log]

View solution in original post

woodcock
Esteemed Legend

I believe that the wildcarding in use is glob, not RegEx: https://en.m.wikipedia.org/wiki/Glob_(programming)

0 Karma

krisreeves
Path Finder
0 Karma

whrg
Motivator

I had a similar issue once. I found out that regular expressions are not fully supported in stanzas.

However, I got it working like this:

[source::/path/(foo|bar)*.log]

ddrillic
Ultra Champion

I would make it - [source::/path/(foo|bar){1}.log], and regex101.com approves of [source::/path/(foo|bar).log] as well.

The documentation at props.conf brings the following example -

Example: [source::....(?<!tar.)(gz|bz2)]

This matches any file ending with '.gz' or '.bz2', provided this is not
preceded by 'tar.', so tar.bz2 and tar.gz would not be matched.

0 Karma

krisreeves
Path Finder

Well, I'll take a workaround 🙂 Hopefully someone from splunk can chime in with a why and an explanation at some point...

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!

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