Splunk Search

extract field between two single quotes please help

r999
Path Finder

Sorry i am a noob to regex and splunk regex especially.

Regex to extarct all that is between the two single quotes. there will never be a single quote in the name.

EG extract the name
Bloggs, Joe:IT

two Message field examples:

The user 'Bloggs, Joe:IT' logged in

Mailbox of 'Smith, John:HR' was opened

How can i:
A) do this using REX
B) do this in props.conf

REX something like

  index =data | rex field=Message "\'(?P<name>)\'"

and from a REx how do you change it to extarct in props.conf?

Thanks in advance

Tags (2)
0 Karma
1 Solution

_d_
Splunk Employee
Splunk Employee

Using rex:


index=data | rex field=Message "\'(?P<name>[^']+)\'"

Using props.conf:

[my_sourcetype]
EXTRACT-abc =
\'(?P<name>[^']+)\'

Hope this helps,

d.

View solution in original post

0 Karma

_d_
Splunk Employee
Splunk Employee

Using rex:


index=data | rex field=Message "\'(?P<name>[^']+)\'"

Using props.conf:

[my_sourcetype]
EXTRACT-abc =
\'(?P<name>[^']+)\'

Hope this helps,

d.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...