# How can i know the Duration of any Stream on each Start/Stop Event from Wowza Logs?

**URL:** <https://community.wowza.com/t/how-can-i-know-the-duration-of-any-stream-on-each-start-stop-event-from-wowza-logs/48531>\
**Category:** Wowza Streaming Engine\
**Created:** [April 13, 2017, 2:20pm UTC](https://community.wowza.com/t/how-can-i-know-the-duration-of-any-stream-on-each-start-stop-event-from-wowza-logs/48531 "2017-04-13T14:20:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravi\_Tuvar](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@Ravi\_Tuvar](https://community.wowza.com/u/Ravi_Tuvar)\
**Post date:** [April 13, 2017, 2:20pm UTC](https://community.wowza.com/t/how-can-i-know-the-duration-of-any-stream-on-each-start-stop-event-from-wowza-logs/48531/1 "2017-04-13T14:20:51Z")

</div>

Lets say i have Stream ABC and I start/Stop stream so many times in a day. I want to get the duration of stream between each Start/Stop event. I have the logs in the Database.

---

<div class="post-metadata">

**Author:** ![IP1](https://avatars.discourse-cdn.com/v4/letter/i/b4bc9f/32.png) [@IP1](https://community.wowza.com/u/IP1)\
**Post date:** [April 13, 2017, 4:23pm UTC](https://community.wowza.com/t/how-can-i-know-the-duration-of-any-stream-on-each-start-stop-event-from-wowza-logs/48531/2 "2017-04-13T16:23:16Z")

</div>

You could call the REST API at any time and get the stream “uptime” which tells you for how long a stream has been published. The API edge for this request would be:

```auto
/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/appName/instances/_definst_/incomingstreams/streamName/monitoring/current

```

If you can’t predict when the stream might start/stop then you should be able to utilize the IMediaStreamActionNotify interface to update/insert to your database during onPublish and onUnpublish events.

[https://www.wowza.com/resources/serverapi/com/wowza/wms/stream/IMediaStreamActionNotify.html](https://www.wowza.com/resources/serverapi/com/wowza/wms/stream/IMediaStreamActionNotify.html)

[https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info](https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info)

---

<div class="post-metadata">

**Author:** ![Ravi\_Tuvar](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@Ravi\_Tuvar](https://community.wowza.com/u/Ravi_Tuvar)\
**Post date:** [April 14, 2017, 5:04am UTC](https://community.wowza.com/t/how-can-i-know-the-duration-of-any-stream-on-each-start-stop-event-from-wowza-logs/48531/3 "2017-04-14T05:04:22Z")

</div>

Currently in my database the Publish and Stop events are being inserted, can i get the duration directly from the database?
