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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...