Splunk Search

Total time taken to execute a log

Bhavika
Loves-to-Learn

I am writing a query which will give total time taken by a log/event for execution in milliseconds :

index=xyz cluster_id = [cluster_id] "logs_statistics"| rex field=_raw "Total Time taken in milliseconds: (?<totalTime>.*\d+) \n*"|table time totalTime

This executes but totalTime is null as shown below :

time                                                                    totalTime

2024-06-23T03:00:45.038422703Z 
2024-06-23T03:00:15.453872121Z 
2024-06-23T03:00:23.33625642Z

 

Expected :

time                                                                    totalTime

2024-06-23T03:00:45.038422703Z544
2024-06-23T03:00:15.453872121Z528

 

What am I missing ?

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Please share your raw event in a code block </> to prevent the removal of important formatting information.

Having said that, is seems unlikely that the ".*" is required in your rex. Try something like this

| rex field=_raw "Total Time taken in milliseconds: (?<totalTime>\d+)"
0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...