Splunk Search

REX - Extracting multiple fields- What's the rex syntax to return microService AND warningMessage?

Mick_OBrien
Path Finder

I have raw message of the form...

2022-08-15T10:41:54.266337+00:00 microService 9bc7520a-4f8d-4edc-a4cd-b08c0fae8992[[APP/PROC/WEB/2]] APPENDER=APP, DATE=2022-08-15 10:41:54.266, LEVEL=WARN , USER=, THREAD=[pool-25-thread-1], LOGGER=Factory, CORR=, INT_CORR=, X-VCAP-REQUEST-ID=, MESSAGE=warningMessage

What's the rex syntax to return microService AND warningMessage?

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Field names are case sensitive so microService is not the same as microservice (the name of the field in the rex extract)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex "^\S+\s(?<microservice>\S+).*MESSAGE=(?<message>.+)"

https://regex101.com/r/nE14zp/1

0 Karma

Mick_OBrien
Path Finder

Tried....

index=splunkIndex "*LEVEL=WARN*" | rex "^\S+\s(?<microservice>\S+).*MESSAGE=(?<message>.+)" | table _raw, microService, message

...and I see the message but NOT the microservice

FYI the returned _raw message starts...

2022-08-15T10:53:25.650962+00:00 microService

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Field names are case sensitive so microService is not the same as microservice (the name of the field in the rex extract)

Mick_OBrien
Path Finder

Thank  you - that worked!

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!

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Splunk Developer Day announcements: AI agents, MCP tools, Forecasting, and Custom ...

Splunk Developer Day was packed with product and platform updates for developers building in the AI ...