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

console log rotation #15

Open
samveen opened this issue Jan 8, 2018 · 1 comment
Open

console log rotation #15

samveen opened this issue Jan 8, 2018 · 1 comment

Comments

@samveen
Copy link
Member

samveen commented Jan 8, 2018

Is it possible to implement standard log rotation mechanism using signal handling?

An example of a good mechanism for log rotation is nginx, which does log rotation via SIGUSR1: when the nginx binary receives this signal, it closes and reopens the log file descriptors. This is used in tandem with logrotate by creating a configuration for nginx in /etc/logrotate.d which contains a postrotate script kill -USR1 $NGINX_PID. logrotate rotates the logs, then signals nginx to close and reopen logs so that nginx has the correct logs open for writing.

@chenglch
Copy link
Contributor

chenglch commented Jan 9, 2018

@samveen , To reduce the open file handlers, the console log files under /var/log/goconserver/nodes/ are closed immediately after writing, in this way, log rotation should be supported. After some testing from @neo954 , the performance may not be influenced too much.

For the log for goconserver itself under /var/log/goconserver/server.log, HUP signal handler is used to restart the logger.

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

3 participants