Splunk Search

Regex help to extract number

splunksogetiht
Explorer

Hello,

My logs contain some sentence like :
"2014-07-22 14:47:10,783 INFO [LoggingInterceptor]|EXIT: CmsXwbDecodingPayloadDriver.decode() : 15ms"

I want to extract the '15' (from '15ms') in a field "decode_time" and display the result for each corresponding event.

I am cleary not confident with regular expressions.

What should I do ?

Thank you

Tags (2)
1 Solution

somesoni2
Revered Legend

Try this

your base search | rex ": (?<decode_time>\d+)ms$"

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Something like this should do the job.

rex "(?<decode_time>\d+)ms$"
---
If this reply helps you, Karma would be appreciated.

somesoni2
Revered Legend

Try this

your base search | rex ": (?<decode_time>\d+)ms$"

splunksogetiht
Explorer

Nice !

Thank you

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...