Splunk Search

Regex to extract status[number] alone from extracted field

Bhuavana
Explorer

Hi,

I have two below field[rstatus] values extracted from events

response.status = 200
response.status = 404

Can you share the regex to extract number[i.e 200 or 404 alone ] from above string.

Tags (2)
0 Karma
1 Solution

gfuente
Motivator

Hello

try this regex:

...| rex field="rstatus" "response\.status\s\=\s(?<yourfield>\d+)" | ...

Regards

View solution in original post

0 Karma

gfuente
Motivator

Hello

try this regex:

...| rex field="rstatus" "response\.status\s\=\s(?<yourfield>\d+)" | ...

Regards

0 Karma

Bhuavana
Explorer

Thanks a lot.. above solution is worked...

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