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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...