Splunk Search

Calculate average, min, max time in ms based on string in event log

rajnsoni92
Explorer

I am a beginner in Splunk queries. I might would be asking for some simple query but I am not able to construct it after searching a lot. Below is my sample event from message field 

 

REPORT RequestId: 288f34e9-5572-4816-d21e-9fcf5965fad0 Duration: 206.64 ms ..

 

I can get all events matching this criteria, but I want to do average, min and max of value present in duration in millisecond. Any help on this would be appreciated.

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex "Duration: (?<duration>[\d\.]+) ms"
| stats avg(duration) as avg min(duration) as min max(duration) as max

View solution in original post

rajnsoni92
Explorer

Thanks @ITWhisperer it worked 🙂

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "Duration: (?<duration>[\d\.]+) ms"
| stats avg(duration) as avg min(duration) as min max(duration) as max
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...