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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...