Splunk Search

Help with regex to extract time in milliseconds

aniketb
Path Finder

Hi,

Can someone help me extract the time in MS from the following log line?

Dec 15, 2015 9:35:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 183678 ms

I'm trying this, but doesn't seem to work correctly:

0 Karma

jplumsdaine22
Influencer

If the message is regular (ie if it always says INFO: Server start up in...) then you would be better off making the regex more explicit.

INFO:\sServer\sstartup\sin\s(?<ms>\d+)\s

You can see the difference between them in the regex debugger on https://regex101.com/

0 Karma

javiergn
Super Champion

On a side note, you can use the following site to test your regex: https://regex101.com/

0 Karma

gfuente
Motivator

Hello

try this regex:

\s*(?<ms>\d*)\s*ms

Regards

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