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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...