Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Commit

Permalink
Fix logrotate issue with logs going to wrong file
Browse files Browse the repository at this point in the history
Noticed that there was a new `/var/log/18f-pages-server/pages.log` file, but
that the logs were still going to an uncompressed
`/var/log/18f-pages-server/pages.log.1`. The old `postrotate` script wasn't
actually successfully restarting the server, and a manual restart also didn't
allow the new process to write to the new log file.

Found out about the `copytruncate` directive, which will work well enough for
18F Pages, though it's not completely ideal. For more information, this issue
has a very helpful comment with a ton of technical background:

foreversd/forever#106 (comment)
  • Loading branch information
Mike Bland committed Oct 1, 2015
1 parent f85cff2 commit c14fc9e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions _deploy/etc/logrotate.d/18f-pages-server
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Note that copytruncate isn't a perfect solution, but it'll suffice for the
# 18f-pages-server. For more information:
# https://github.com/foreverjs/forever/issues/106#issuecomment-116933382
/var/log/18f-pages-server/pages.log {
rotate 12
monthly
compress
missingok
notifempty
postrotate
/usr/local/bin/forever restart /usr/local/bin/18f-pages
endscript
copytruncate
}

0 comments on commit c14fc9e

Please sign in to comment.