Skip to content

Logrotate not resetting counter #142

@kevinkk525

Description

@kevinkk525

I'm having a bit of trouble with using grok_exporter with a copytruncate logrotate.

I'm using a counter to count e.g. the amount of ERROR lines in a logfile. That file gets rotated every day at 0:00am.

Expected behaviour
So I expect grok_exporter to read that file (readall=true btw) and count the ERROR lines, meaning after log rotation when the file is empty, I would expect that counter to be 0.

Actual behaviour
Instead, the counter continues to rise, grok_exporter just adds the new lines to the counter of the old lines. And when I restart grok_exporter, it falls back to what is actually in the current file.

Sadly this is a not helpful behaviour if you just want to count all ERROR messages within a day (within a single file that gets rotated every day).

System
Ubuntu 20.04
Grok built from source in docker container using dockerfile from #62

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions