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

Logrotate #26

Closed
phungleson opened this issue Jan 9, 2014 · 12 comments
Closed

Logrotate #26

phungleson opened this issue Jan 9, 2014 · 12 comments
Labels

Comments

@phungleson
Copy link

Hi guys, just want to check if eye has configuration to rotate all log files from code instead of setting up some other 3rd party process.

@kostya
Copy link
Owner

kostya commented Jan 9, 2014

nothing special, how it should work?

kostya added a commit that referenced this issue Jan 12, 2014
@kostya
Copy link
Owner

kostya commented Jan 18, 2014

in 0.5.1 added for eye self-log (for processes need to think more)

example:

Eye.config do
  logger "/tmp/eye.log", 7, 20.megabytes
end  

@phungleson
Copy link
Author

Wow that's good, thanks man!

Might be helpful if there is an option of daily rotation. Process is quite important as well.

@phungleson
Copy link
Author

No biggie, just wondering why you don't use some standard logger library like the one from the core so that you can re-use all functionalities.

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html

@kostya
Copy link
Owner

kostya commented Jan 19, 2014

for self-log already used two options: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new-label-Synopsis
for processes not so easy because eye using stdout redirection in function Process::spawn which not supported rotation options.

@phungleson
Copy link
Author

Oh ok, thanks!

Hopefully you can find a way to make process log work. If you already have some ideas, you might want point it here so I can give it a try.

@felixbuenemann
Copy link

@phungleson You can usually use syslog-ng copytruncate strategy to rotate logs without having to instruct processes to reopen their file descriptors. Copytruncate just copies the original logfile for archiving and then truncates the original logfile, so the app can keep writing to the same file descriptor.

I haven't used eye yet, so not sure if this will help you.

@pekhee
Copy link

pekhee commented Apr 20, 2014

What about monitored-process | eye-logrotate path/to/main/log/file?

Say eye-logrotate is a BASH script, it gets stdin, writes to main log file and rotate/compress old log data?

@kostya
Copy link
Owner

kostya commented May 13, 2014

monitored-process | eye-logrotate path/to/main/log/file is not really nice, because to run this need to use sh: start_command "sh -c 'monitored-process | eye-logrotate path/to/main/log/file'", this command not allowed daemonization.

@pekhee
Copy link

pekhee commented May 13, 2014

Process.fork do
  start_command "sh -c 'monitored-process | eye-logrotate' "
end

will this work?

Also if this is important to you, as another approach, we can rotate logs before starting processes. So maybe not in realtime, but at least each time processes get restarted logs get rotated.

@kostya
Copy link
Owner

kostya commented May 31, 2014

solved by gem https://github.com/kostya/eye-rotate

@kostya kostya closed this as completed May 31, 2014
@phungleson
Copy link
Author

Thanks!

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

No branches or pull requests

4 participants