Splunk Search

Extract data from one field ot another using Regex

PTC_
Explorer

Hello,
(I will use fictional data to give examples)

I'm trying to use regex to extract data from one field to another, but Splunk doesn't find the data I want in this specific field.

The field I want to extract data (let's call it DATA_FIELD) looks something like:
SMBv2 guid=111111-b111-1111-1111-11111aaaa11 time=2023-02-27 15:17:35 domain=DOMAINNAME version=12.1.11111 ntlm-ver=15 domain=DOMAINNAME name=HOSTNAME domain-dns=DOMAINDNS name-dns=NAMEDNS

I want to extract "name=HOSTNAME" from this field to another one (HOSTNAME_FIELD)
I suspect my Regex parameters are not working with Splunk, even though I tested them all in regex101 .
Example:
| rex field=DATA_FIELD "HOSTNAME_FIELD: name=(?<name>\S*(?))\s"

I tried many forms of regex, such as:
name.(?<=[=])\S*(?:\s)?
.name=(?<=[=])\S*(?)
name=(?<name>\S*(?))\s

None of them worked in Splunk but they work in regex101.

Is this problem on the regex formula itself on Splunk? Or is it problem with the sintax?
What's the best way to extract this data?

Labels (4)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex field=DATA_FIELD "name=(?<HOSTNAME_FIELD>\S*?)\s"
0 Karma
Get Updates on the Splunk Community!

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...

Splunk AppDynamics Agents Webinar Series

Mark your calendars! On June 24th at 12PM PST, we’re going live with the second session of our Splunk ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...