Skip to content

check-log.rb clobbers state file #89

Description

@zenmetsu

when specifying a directory with -s to store the state file, the check naively assumes that there is only a single check against the given file.

If you are monitoring /var/log/nginx/access.log for instances of http_status=502 and specify -s /tmp, then a state file containing the last scanned line number gets created as /tmp/var/log/nginx/access.log.

The problem comes when you attempt to create a second check, say for instances of http_status=503 and specify the same -s /tmp directory. the two checks will end up clobbering the other's files, and detection of the regex match will be inconsistent and unreliable.

Perhaps the file's contents should contain the check name as well, i.e. /tmp/var/log/nginx/access.log should contain two lines, such as:

check_http_502:80105
check_http_503:79940

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions