# Logstash duration management

**URL:** <https://discuss.elastic.co/t/logstash-duration-management/284716>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [September 21, 2021, 11:57am UTC](https://discuss.elastic.co/t/logstash-duration-management/284716 "2021-09-21T11:57:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simoamarca](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@simoamarca](https://discuss.elastic.co/u/simoamarca)\
**Post date:** [September 21, 2021, 11:57am UTC](https://discuss.elastic.co/t/logstash-duration-management/284716/1 "2021-09-21T11:57:54Z")

</div>

Halloooo, I would like to ask you how to manage, with rubydebug in logstash, durations with format like 07:22:27.

I wrote a script..

```auto
         ruby {
        # code => "
        # s = event.get('Logon duration')
        # vals = s.match /(\d+):(\d+):(\d+)/
        # if vals then
        # seconds = vals[1].to_i*3600+vals[2].to_i*60+vals[3].to_i
        # event.set('Logon duration', seconds)
        # end
        # "
	    # }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 19, 2021, 11:58am UTC](https://discuss.elastic.co/t/logstash-duration-management/284716/2 "2021-10-19T11:58:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
