Splunk Search

Extract string using rex

RVDowning
Contributor

I have data that looks like:
20140609 19:14:03 [PERF] [CREATE PLAN START] Action=CreatePlan,
and would like to extract the text between the second pair of brackets, namely in the above line the text "CREATE PLAN START."

I tried rex field=_raw "]s+[=(?[]])" but obviously this isn't right.

Tags (2)
0 Karma
1 Solution

RVDowning
Contributor

Finally got it right:

rex field=_raw "] [(?.+?)]"

View solution in original post

RVDowning
Contributor

Finally got it right:

rex field=_raw "] [(?.+?)]"

aweitzman
Motivator

This looks like it might work for you:

rex field=_raw "]\s+\[(?<step>[\w\s]*)\]"

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