Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check-log.rb clobbers state file #89

Open
zenmetsu opened this issue May 1, 2024 · 0 comments
Open

check-log.rb clobbers state file #89

zenmetsu opened this issue May 1, 2024 · 0 comments

Comments

@zenmetsu
Copy link

zenmetsu commented May 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant