Splunk Search

How to extract value under double quotes using the rex command?

saravanafd
Explorer

Has been busy for "639" seconds

using rex command i need to extract value 639 and store it in one field.

Please help !!!

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try this:

... | rex "busy for \"(?<one>\d+)" | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Try this

| makeresults 
| eval msg ="busy for \"639\" seconds" 
| rex field=msg "\"(?P<seconds>[\d]+)\""
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this:

... | rex "busy for \"(?<one>\d+)" | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

saravanafd
Explorer

Thank you very much for the resolution. Works perfectly 🙂

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

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

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...