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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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