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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...