~~NOCACHE~~ ## 50.ログ管理-logrotate ### logrotateの設定方法 #変更 vi /etc/logrotate.conf #適用 logrotate /etc/logrotate.conf #ログローテート強制実行 logrotate -f /etc/logrotate.conf ### logrotateの設定詳細 変更するのは、ローテーションの間隔と保存する世代数で良い #ローテーションを実施する間隔 #[daily | weekly | monthly | yearly] weekly #保存する世代数 #rotate [数値] rotate 4 #ローテート後に新しいファイルを作成 #[create | nocreate] create #個別にログ設定ファイルを読み込むディレクトリパス include /etc/logrotate.d #ローテート後ファイルの接尾辞(dateextは日付、nodateextは連番) #[dateext | nodateext] dateext https://hackers-high.com/linux/man-jp-logrotate/ ※"%%/etc/logrotate.d/%%"配下のファイルすべてに影響がある。 個別のログごとに調整したい場合は、"%%/etc/logrotate.conf%%"ではなく"%%/etc/logrotate.d/%%"配下のファイルで設定する。 ### 初期値 # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # system-specific logs may be also be configured here. {{tag>AWS RHEL 実践的}}