Skip to content

Instantly share code, notes, and snippets.

@nikushi
Last active December 14, 2015 15:09
Show Gist options
  • Save nikushi/5105939 to your computer and use it in GitHub Desktop.
Save nikushi/5105939 to your computer and use it in GitHub Desktop.
1日1回、日付変更以後に前日分のログファイルを前日日付でcompressしてローテートするサンプル
/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
}
@nikushi
Copy link
Author

nikushi commented Mar 7, 2013

設定ファイルを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