- 从 Avamar 19.1 升级到 19.2 后,/var/log/messages 中显示 logrotate 错误。
admin@avamar:~/>: grep -i "logrotate.service" /var/log/messages Feb 1 00:00:01 avamar systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE Feb 1 00:00:01 avamar systemd[1]: logrotate.service: Unit entered failed state. Feb 1 00:00:01 avamar systemd[1]: logrotate.service: Failed with result 'exit-code'. Feb 2 00:00:03 avamar systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE Feb 2 00:00:03 avamar systemd[1]: logrotate.service: Unit entered failed state. Feb 2 00:00:03 avamar systemd[1]: logrotate.service: Failed with result 'exit-code'.Feb 3 0:00:01 avamar systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE Feb 3 00:00:01 avamar systemd[1]: logrotate.service: Unit entered failed state.Feb 3 0:00:01 avamar systemd[1]: logrotate.service: Failed with result 'exit-code'.
- 读取 (/var/log/messages) 后,如果在 apache2 的 logrotate.d 中找不到 file: /etc/init.d/apache2 来运行 prerotate,则会触发这些错误
Feb 2 16:30:02 avamar logrotate: ALERT exited abnormally with [1] Feb 2 16:30:02 avamar logrotate: logrotate_script: line 1: /etc/init.d/apache2: No such file or directory Feb 2 16:30:02 avamar logrotate: error: error running non-shared prerotate script for /var/log/apache2/access_log of '/var/log/apache2/access_log ' Feb 2 16:30:02 avamar logrotate: logrotate_script: line 1: /etc/init.d/apache2: No such file or directory Feb 2 16:30:02 avamar logrotate: error: error running non-shared prerotate script for /var/log/apache2/ssl_request_log of '/var/log/apache2/ssl_request_log ' Feb 3 00:00:01 avamar logrotate[14221]: logrotate_script: line 1: /etc/init.d/apache2: No such file or directory Feb 3 00:00:01 avamar logrotate[14221]: error: error running non-shared prerotate script for /var/log/apache2/access_log of '/var/log/apache2/access_log ' Feb 3 00:00:01 avamar logrotate[14221]: logrotate_script: line 1: /etc/init.d/apache2: No such file or directory Feb 3 00:00:01 avamar logrotate[14221]: error: error running non-shared prerotate script for /var/log/apache2/ssl_request_log of '/var/log/apache2/ssl_request_log ' Feb 3 00:00:01 avamar systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE Feb 3 00:00:01 avamar systemd[1]: logrotate.service: Unit entered failed state.Feb 3 0:00:01 avamar systemd[1]: logrotate.service: Failed with result 'exit-code'.
- Avamar 服务器正在运行的是带有 SLES 12 SP 4 的 19.2 版本:
admin@avamar:~/>: cat /etc/*release* SUSE Linux Enterprise Server 12 (x86_64) VERSION = 12 PATCHLEVEL = 4 # 此文件已弃用,并将在之后的服务包或版本中删除。# 有关此版本的详细信息,请查看 /etc/os-release。NAME="SLES" VERSION="12-SP4" VERSION_ID="12.4" PRETTY_NAME="SUSE Linux Enterprise Server 12 SP4" ID="sles" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:suse:sles:12:sp4" 
- 手动运行命令检查目录:/etc/init.d/apache2 失败,并显示“No such file or directory”。
admin@avamar:~/>: ls -ltrh /etc/init.d/apache2 ls: cannot access '/etc/init.d/apache2': No such file or directory 
 

原因

软件错误,导致 logrotate for apache2 检查 init.d 文件,这些文件在 SLES 12 中不存在。
在 SLES 11 中,使用的是 init.d 服务,但在 SLES 12 中,使用的是 systemctl 服务。

解决方案

解决办法
1.以管理员用户身份登录到实用程序节点或单节点系统,并成为 root 用户。
2.将现有的 logrotate 文件移到一边
mv /etc/logrotate.d/apache2 /tmp
3.使用 vi 重新创建文件
vi /etc/logrotate.d/apache2 4.将以下行复制到记事本或记事本++ 等文本编辑器中(请勿使用 Word 或写字板,因为会引入特殊字符)
/var/log/apache2/access_log /var/log/apache2/ssl_request_log {
compress
dateext
maxage 365
rotate 99
size=+4096k
notifempty
missingok
create 640 wwwrun www
sharedscripts
postrotate
systemctl reload apache2.service
sleep 60
endscript
}

/var/log/apache2/error_log /var/log/apache2/suexec.log /var/log/apache2/ssl_engine_log /var/log/apache2/deflate.log {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
create 640 wwwrun www
sharedscripts
postrotate
systemctl reload apache2.service
sleep 60
endscript
}

5.将编辑器中的文本粘贴到 Avamar 节点上新建的文件中
6.保存更改
7.设置文件的正确权限
chmod 644 /etc/logrotate.d/apache2 8.以 root 用户身份测试日志轮换。
logrotate -f /etc/logrotate.conf
永久修复 :此问题将在下一个 Avamar 版本中修复: 19.3.