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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...