Getting Data In

field extraction working with rex but not props.conf

jdmclemore
Path Finder

I am trying to extract a portion of the source as a field. Here's what the source looks like:

 

D:\Host Logs\info.server.02.mfl

 

I'm trying to extract "info" from the source filename and this works perfectly as a splunk search:

 

search | rex field=source "D:\\\Host Logs\\\(?<newfield>[\w]+).\w+.\w+.(mfl|MFL)"

 

But if I put this in props.conf for this sourcetype as a search-time extraction, it's not working:

 

EXTRACT-sourcefield = "D:\\\Host Logs\\\(?<newfield>[\w]+).\w+.\w+.(mfl|MFL)" in source

 

I've tried multiple versions of this, taking out the extra "\", removing the quotes, etc., but cant seem to get this field to extract. A "splunk btool props list..." shows that the props.conf file is being used. It's in an app in /opt/splunk/etc/apps. This is Splunk Enterprise 8.0.4.1.

Edit: Here are all the versions I've tried so far...

 

EXTRACT-sourcefield = D:\x5CHost Logs\x5C(?<newfield>[\w]+).\w+.\w+.(mfl|MFL) in source
EXTRACT-sourcefield = D:\\Host Logs\\(?<newfield>[\w]+).\w+.\w+.(mfl|MFL) in source
EXTRACT-sourcefield = "D:\\\Host Logs\\\(?<newfield>[\w]+).\w+.\w+.(mfl|MFL)" in source
EXTRACT-sourcefield = "D:\\Host Logs\\(?<newfield>[\w]+).\w+.\w+.(mfl|MFL)" in source

 

Labels (1)
0 Karma

amiftah_splunk
Splunk Employee
Splunk Employee

Or you can try:

EXTRACT-sourcefield = D:\x5CHost Logs\x5C(?<newfield>[\w]+).\w+.\w+.(mfl|MFL)
0 Karma

jdmclemore
Path Finder

Thanks @amiftah_splunk  - unfortunately, this isn't working either.

0 Karma

amiftah_splunk
Splunk Employee
Splunk Employee

Are you extracting from a field?

You may need to use transforms:

transforms.conf:

[example]

SOURCE_KEY = source

REGEX = <your_regex>

props.conf:

REPORT-example = example

0 Karma

jdmclemore
Path Finder

Tried using REPORT and transforms, but still no good extraction...

0 Karma

jdmclemore
Path Finder

Yes, extracting from the source field. I haven't tried going the REPORT route and using transforms.conf because its a simple inline extraction that shouldnt require transforms, per the documentation. Maybe worth giving it a shot though.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Have you tried this?

EXTRACT-sourcefield = D:\\Host Logs\\(?<newfield>[\w]+)\.\w+\.\w+\.(mfl|MFL) in source

 

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

jdmclemore
Path Finder

Thanks @richgalloway  - yes I've tried that in props, but no extraction.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...