# Is it possible to increment or decrement a time field based on seconds and store it as another attribute?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583>\
**Category:** Logstash\
**Created:** [February 18, 2017, 9:35am UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583 "2017-02-18T09:35:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 18, 2017, 9:35am UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/1 "2017-02-18T09:35:44Z")

</div>

Hi,

I am using ELK GA 5.0.0. I have a time entry like `06:52:02` and a delay entry (in seconds) like `1.016`. I want to push another attribure to elasticsearch, by subtracting seconds from timefield, say `06:52:01` in this case. Is this possible?

Thank you.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 19, 2017, 7:13am UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/2 "2017-02-19T07:13:51Z")

</div>

With a ruby filter you could.

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 19, 2017, 5:35pm UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/3 "2017-02-19T17:35:47Z")

</div>

@warkolm , I am a beginner, could you kindly post the code?

Thanks in advance.. 🙂

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 19, 2017, 9:18pm UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/4 "2017-02-19T21:18:35Z")

</div>

I don't know ruby, but if you have a search through the posts here you will find similar threads with examples.

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 20, 2017, 8:53am UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/5 "2017-02-20T08:53:52Z")

</div>

Neither do I know ruby 😞

It will be really helpful if someone like @magnusbaeck or @theuntergeek or @Christian_Dahlqvist look into it

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 20, 2017, 8:22pm UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/6 "2017-02-20T20:22:14Z")

</div>

Please don't ping other people like that, if you aren't willing to do a search and spend some time, why would they provide you a direct answer?  
We do like to help, but you need to help yourself as well.

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 21, 2017, 4:46am UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/7 "2017-02-21T04:46:17Z")

</div>

You're welcome.. 'll try myself..

---

<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:** [March 21, 2017, 4:46am UTC](https://discuss.elastic.co/t/is-it-possible-to-increment-or-decrement-a-time-field-based-on-seconds-and-store-it-as-another-attribute/75583/8 "2017-03-21T04:46:38Z")

</div>

Closed on March 21, 2017, 4:46am UTC

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