現象
Uppgradera från 19.1 till 19.2
– efter uppgraderingen från Avamar
19.1 till 19.2 visas logrotate-fel i /var/log/messages.
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 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 00:00:01 avamar systemd[1]: logrotate.service: Failed with result 'exit-code'.
– Granskar (/var/log/messages), dessa fel uppstår efter att filen inte kan hittas: /etc/init.d/apache2 för att köra förrotation i logrotate.d för apache2
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 00:00:01 avamar systemd[1]: logrotate.service: Failed with result 'exit-code'.
– Avamar-servern kör 19.2, med SLES 12 SP 4:
admin@avamar:~/>: cat /etc/*release* SUSE Linux Enterprise Server 12 (x86_64) VERSION = 12 PATCHLEVEL = 4 # Den här filen är inaktuell och tas bort i framtida service pack eller versioner. # Läs /etc/os-release om du vill ha mer information om den här versionen. 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"
– Kör kommandot manuellt för att kontrollera katalogen: /etc/init.d/apache2 misslyckas med ”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
原因
Ett programvarufel, som orsakade logrotate för apache2 för att kontrollera init.d-filer som inte finns i SLES 12.
I SLES 11 användes init.d-tjänsten men i SLES 12 används systemctl-tjänsten.
解決方法
Alternativ lösning:
1. Logga in på verktygsnoden eller i systemet med en nod som administratör och bli rotanvändare.
2. Flytta den befintliga logrotate-filen åt sidan
mv /etc/logrotate.d/apache2 /tmp
3. Återskapa filen med hjälp av vi
vi /etc/logrotate.d/apache2
4. Kopiera följande rader till en textredigerare, till exempel Anteckningar eller Notepad++ (använd inte Word eller Wordpad eftersom det medför specialtecken)
/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. Klistra in texten från redigeraren till en nyskapad fil på en Avamar-nod
6. Spara ändringarna
7. Ange rätt behörigheter för filen
chmod 644 /etc/logrotate.d/apache2
8. Testa loggrotationen som rot.
logrotate -f /etc/logrotate.conf
Permanent lösning: Problemet korrigeras i nästa Avamar-version: 19.3.
対象製品
Avamar
製品
Avamar, Avamar Server