logrotateはファイルを圧縮しません

logrotateはファイルを圧縮しません

logrotateはファイルを圧縮しないので問題があります。 Centos 7からAlma Linuxに移行しましたが、動作しません。 /var/log/ciscoでログファイルを回転して圧縮するためにlogrotateを取得しようとしています。 Logrotate はログを正常に回転させ、ファイル名に日付を追加します。これは /etc/logrotate.d/cisco_syslog の設定です。

/var/log/cisco/* {
notifempty
weekly
olddir old
rotate 12
compress
create
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    /usr/bin/systemctl restart tail_aggregate.service 2> /dev/null
endscript }

/var/log/messagesのエラーメッセージ

Feb 13 03:50:40 management logrotate: ALERT exited abnormally with [1]

このようにデバッグでlogrotateを実行すると

logrotate -d -v /etc/logrotate.d/cisco_syslog --force

ファイル圧縮を正常に試みました。

compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip
compressing log with: /bin/gzip

gzipがインストールされており、ファイルを手動で圧縮できます。

編集:sestatus出力

SELinux status:                 disabled

ausearch -ts 今日の出力 -m avc -i

<no matches>

ls -laZ /var/log/cisco の出力

出力

セキュリティ上の理由から、ファイル名は隠されます。

/etc/logrotate.confの出力

# 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.

ログ回転バージョン

logrotate 3.14.0

ベストアンサー1

おすすめ記事