Last active
December 14, 2015 15:09
-
-
Save nikushi/5105939 to your computer and use it in GitHub Desktop.
1日1回、日付変更以後に前日分のログファイルを前日日付でcompressしてローテートするサンプル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/var/log/myapp/app.log { | |
rotate 30 | |
daily | |
missingok | |
ifempty | |
compress | |
dateext | |
extension .log | |
lastaction | |
/bin/mv /var/log/myapp/app-`date '+%Y%m%d'`.log.gz /var/log/myapp/app-`date '+%Y%m%d' -d '1days ago'`.log.gz | |
endscript | |
} |
Author
nikushi
commented
Mar 7, 2013
ローテート後のファイル名
app-20130307.log.gz # gunzip => app-20130101.log
設定ファイルをdry-runするメモ
$ logrotate -dv /etc/logrotate.d/myapp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment