Restore value of Counter when it get reach maximum limit or certain value

I am using InfluxDB 2.0.4 and reading the data from Telegraf 1.21.
Few of the counter in my data is always increasing (follow increasing function trend).
After some time it reaches a very higher value.
Now I want to reset this counter value to 0.

Example. Counter 1 started from 0 and continuously increasing.

Now I want to put some trigger or reset conditions in telegraf like if Counter 1 goes beyond 999999 I want to reset the value of Counter 1 to 0.


What are some examples of counter 1? Is the value the amount the counter should increase by or the value of the counter itself?




Counter 1 is representing just a generic field that is increasing according to time and after a certain value of Counter 1 which is a field becomes too large (suppose 999999999) and now we want to reset the value of Counter1 as 0.

ok so if you use telegraf to “reset” this field when it is 999999999 say to 0, then the very next metric comes in with 1000000000?

yes next metric can come with 999999999 and more then this value its can’t be less then 999999999

I would look at the starlark processor. You can check the value of the field and see if it is 999999999 or greater and set it to 0. Assuming that is the behavior you want.