Splunk Search

Extreme rex help

ddefer
New Member

I am comfortable with the rex command when straightforward text strings are involved.

I've got something that is decidedly NOT a straightforward text string.  It is a substring in a larger log entry (not shown) and looks like this:

RESULTVECTOR="{2106177} EMAAC02:0(16)/EMACC65:0(68)/BPOSTK01:0(476[11+436+11])/BPOSCC01:0(2072)/BPOSTK01:0(629[15+590+9])/BPOSCC02:0(867)/EMACC28:0(42)/BPOSRT01:0(101)/EMACC65:0(129)/BPOSRT10:0(2063152[15+2063087+31])/EMACC65:0(30)/EMAAC10:0(37884[13+37829+25])/EMACC51:0(23)

The first part identifies complex substring part (RESULTVECTOR) and the overall response time for a transactions.   The rest is a set of sorta-name-value-pairs (delimited by "/") that tell me a <sub-process name>:<sub-process response code>(<sub-process response time>)[<optional set of sub-sub-process response times of arbitrary length, delimited by "+">] 

I want to recursively process this string to, at a minimum, the total response time and a set of details for each sub-process (I am willing to ignore the sub-sub-process data for now).

I can't get past the first sub-process.  My attempt at rex so far is:

rex field=_raw max_match=100 " RESULTVECTOR=\"{(?<TOTAL_RESP>.*)} (?<A_PROC>\w+):(?<A_RC>\d+)\((?<A_RESP>\d+).*"

Is it even possible to capture the data I need using rex? 

 

Labels (4)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If you split it into two rex you could do this

| rex " RESULTVECTOR=\"{(?<TOTAL_RESP>.*)} (?<responses>.*)"
| rex max_match=0 field=responses "(?<A_PROC>\w+):(?<A_RC>\d+)\((?<A_RESP>\d+)(?<subsub>\[[\d\+]+\])?"
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...