Splunk Search

Sum of call_duration

joshftx
Explorer

I have a field called "call_duration" expressed as 00:00:17, and another field called "Party1Name" which is simply a name string.
How can I sum these duration times up per caller?
I have tried this:

sourcetype=smdr|stats sum(Call_duration) by Party1Name
but Call_duration ends up being empty.

Tags (2)
0 Karma
1 Solution

_d_
Splunk Employee
Splunk Employee

Try this instead:

sourcetype=smdr | eval duration=strptime(call_duration,"%H:%M:%S") | stats sum(duration) by Party1Name

Hope this helps.

> please upvote and accept answer if you find it useful - thanks!

EDIT: The reason you need to use strptime functions is because Splunk looks at the call_duration as a simple string and not as seconds that can be added or performed any arithmetic functions on. Hope this clarifies it.

View solution in original post

_d_
Splunk Employee
Splunk Employee

Try this instead:

sourcetype=smdr | eval duration=strptime(call_duration,"%H:%M:%S") | stats sum(duration) by Party1Name

Hope this helps.

> please upvote and accept answer if you find it useful - thanks!

EDIT: The reason you need to use strptime functions is because Splunk looks at the call_duration as a simple string and not as seconds that can be added or performed any arithmetic functions on. Hope this clarifies it.

_d_
Splunk Employee
Splunk Employee

Glad to hear. Please mark as answered. Thanks.

0 Karma

joshftx
Explorer

Actually that worked. Thanks. Call_duration had wrong case.

0 Karma

joshftx
Explorer

Thanks for the quick response, however, its still blank.

0 Karma
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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

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