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

A flag to ignore traversing a log file on initial read #10

Open
codepattern opened this issue Apr 27, 2016 · 5 comments
Open

A flag to ignore traversing a log file on initial read #10

codepattern opened this issue Apr 27, 2016 · 5 comments

Comments

@codepattern
Copy link

First, thank you for the ruby plugin.

I would like to suggest the capability to ignore the initial search on a log file. This is option is important when you are starting to watch an existing log file which in some cases are extremely large in size. The initial read takes a higher that normal amount of cpu and memory to traverse the file. This new option would give the check-log.rb the capability to commerce monitoring from the last line / end of file position line in the file.

@codepattern
Copy link
Author

Any update or thoughts on this request? Thanks

@aayore
Copy link

aayore commented Aug 16, 2016

I can see the downside to reading a huge log file. But this could also be solved with logrotate or other system utilities, so I wouldn't think it's a terribly high priority. Just my $.02.

@codepattern
Copy link
Author

Thanks for the response. But logrotate would not solve the issue. If I wanted to start monitoring the log file from the present point in time and the log is halfway through its size limit rotation, the check would still have to traverse the previous content. What I am asking is that it not read anything previous to its start or give the ability to set this flag on or off.

@majormoses
Copy link
Member

@codepattern how would this work? I am wondering if say a max number of lines might be what we are looking for?

@majormoses
Copy link
Member

@codepattern I have not heard from you on how this would work and would need some additional detail on how you imagine this feature being used. Without such here are some thoughts, apologies if I am missing about your intended use case that makes this more desireable.

What I am asking is that it not read anything previous to its start

Are you referring to the first time the check is invoked and a pos file is created? So the behavior would be if pos file does not exist then write out the pos file as if it read and evaluated it with an ok? If such behavior was to be considered it would certainly need to be behind an option with a default of false.

Log events are inherently in the past so I fail to understand the value of choosing to not evaluate all past events. From a practical standpoint this feature will ignore real events that should be evaluated; while we can empower the user to do so I don't think it's a good decision and question the choices that got them to this point.

In the meantime while we discuss this you could try these workarounds:

  1. set occurrences to > 1 which should always ensure that it needs to fail more than once before alerting with whatever handler you are using. https://sensuapp.org/docs/0.28/reference/plugins.html#check-definition-attributes
  2. Resolve the first occurrence using an api or uchiwa dashboard
  3. mv or rm the existing log file and recreate it.

@majormoses majormoses changed the title Suggestion: A flag to ignore traversing a log file on initial read A flag to ignore traversing a log file on initial read May 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants