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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...