# Logstash - elapsed seconds to something human-readable

**URL:** <https://discuss.elastic.co/t/logstash-elapsed-seconds-to-something-human-readable/204602>\
**Category:** Logstash\
**Created:** [October 22, 2019, 8:29am UTC](https://discuss.elastic.co/t/logstash-elapsed-seconds-to-something-human-readable/204602 "2019-10-22T08:29:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![francesc.recasens](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@francesc.recasens](https://discuss.elastic.co/u/francesc.recasens)\
**Post date:** [October 22, 2019, 8:29am UTC](https://discuss.elastic.co/t/logstash-elapsed-seconds-to-something-human-readable/204602/1 "2019-10-22T08:29:30Z")

</div>

Good morning,

I'm using Logstash with elapsed plugin to calculate the time between two timestamps. It works perfectly and the field is a Number in seconds.

Is there a way to create a new field with that value in a human readable way? I need the seconds field to make some statistics (number of elapsed seconds in a month, for example), but I need another field to read the value (74685 seconds to something like "20 hours, 44 minutes and 45 seconds".

I tried to convert the field to date and to use date filter, but it doesn't work.

I think that the biggest elapsed time will have months.

Thank you so much,

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 22, 2019, 3:19pm UTC](https://discuss.elastic.co/t/logstash-elapsed-seconds-to-something-human-readable/204602/2 "2019-10-22T15:19:51Z")

</div>

You can do it in a ruby filter. Take a look at [this](https://stackoverflow.com/questions/1679266/can-ruby-print-out-time-difference-duration-readily).

---

<div class="post-metadata">

**Author:** ![francesc.recasens](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@francesc.recasens](https://discuss.elastic.co/u/francesc.recasens)\
**Post date:** [October 23, 2019, 7:32am UTC](https://discuss.elastic.co/t/logstash-elapsed-seconds-to-something-human-readable/204602/3 "2019-10-23T07:32:40Z")

</div>

Thank you so much for your reply. I'll create a file and I will call it form the ruby filter!

---

<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:** [November 20, 2019, 7:32am UTC](https://discuss.elastic.co/t/logstash-elapsed-seconds-to-something-human-readable/204602/4 "2019-11-20T07:32:41Z")

</div>

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