Splunk Search

Rex to get data between curly brackets

bsaujla131984
Path Finder

I am struggling to fetch the data between curly brackets . Have tried multiple rex searches, however still not getting the required output :-

Message in log is as below:

msg=Call to https://hostname/rs/cf/webservice/user/authn failed. Status code: 401, response: {"statusCode":"Code","message":"Authentication failed"}|exception=|

I want to everything after response till exception.

Can anyone help with this please?

Labels (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

... | rex "(?ms)response:\s*(?<MyNewField>\{[^\}]+\})"

View solution in original post

woodcock
Esteemed Legend

Like this:

... | rex "(?ms)response:\s*(?<MyNewField>\{[^\}]+\})"

bsaujla131984
Path Finder

Thanks Woodock. This was really quick response.

May I know the purpose of (?ms) ?

woodcock
Esteemed Legend

In case your raw event data is multi-line. You probably do not need it.

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 ...