Linux Operating System (MOSC)

MOSC Banner

/etc/logrotate.d/unique設定適用の失敗

edited Oct 1, 2024 4:25AM in Linux Operating System (MOSC) 10 commentsAnswered

バージョン:Oracle Linux 8.9
/etc/logrotate.d/uniqueの設定変更が意図通りに適用されません。
変更前:
{
create
compress
delaycompress
missingok
weekly
rotate 10
sharedscripts
postrotate
/bin/kill -HUP cat /var/run/syslogd.pid 2> /dev/null 2> /dev/null || true
endscript
}
実行コマンド:# /usr/sbin/logrotate -f /etc/logrotate.d/unique
こちらの設定で手動ローテーションし、10世代分のログが保存されることを確認しました。

変更後:
{
create
compress
missingok
weekly
rotate 7
dateformat -%Y%m%d_%H%M%S
sharedscripts
postrotate
/bin/kill -HUP cat /var/run/syslogd.pid 2> /dev/null 2> /dev/null || true
endscript
}
実行コマンド:# /usr/sbin/logrotate -f /etc/logrotate.d/unique
続いて[rotate 10→7]/[delaycompressの削除][dateformat -%Y%m%d_%H%M%Sの追加]に変更し手動ローテーションを実施しました。

・delaycompressの削除により、ローテーション済みファイルが1世代目から圧縮されました。
・dateformat -%Y%m%d_%H%M%Sが適用されません。
・rotate 7 が適用されず、状況としてローテーション済みのファイルは8世代分保存されております。

解決方法をご教授いただけますでしょうか。
以上、よろしくお願い致します。

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center