Splunk Search

within "Extract Fields", how can I start the regular expression with a value from another field?

chgray
New Member

I have a field 'foo', it has a value like "data1_data2"

I'd like to make an Extracted Field that starts with the contents of 'foo', instead of the entire raw event

is that possible?

Tags (1)
0 Karma

gjanders
SplunkTrust
SplunkTrust

You may wish to keep in mind that if the field is an auto-extracted field, the extraction in the props.conf will need to be done on the raw data.

In other words if your data looks like:
key=value key2=value3 key3=value3

A field extraction using the "in" keyword in the props.conf file such as:
EXTRACT-field3 = [A-Za-z]+ in key3

Will not work as expected as the key/key2/key3 fields are not index time fields, they are search time only.

0 Karma

ddrillic
Ultra Champion

Information about it at - Extract fields using regular expressions

Maybe change -

... | rex field=_raw "From: (?<from>.*) To: (?<to>.*)"

to - ... | rex field=foo "From: (?<from>.*) To: (?<to>.*)"

Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...