Score:0

Logrotate Fails Without Error

cn flag

Ok, I made a boo-boo. I think

Problem: Logrotate fails (or I incorrectly think its dead) and does not provide any error message to explain why:

● logrotate.service - Rotate log files
   Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
   Active: inactive (dead) since Fri 2021-12-31 13:05:25 CST; 42min ago
     Docs: man:logrotate(8)
           man:logrotate.conf(5)
  Process: 27844 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
 Main PID: 27844 (code=exited, status=0/SUCCESS)

Dec 31 13:05:25 server1.example.com systemd[1]: Starting Rotate log files...
Dec 31 13:05:25 server1.example.com systemd[1]: logrotate.service: Succeeded.
Dec 31 13:05:25 server1.example.com systemd[1]: Started Rotate log files.

I wanted to automatically restart logrotate using systemd because sometimes it would fail after a reboot. Therefore in my /usr/lib/systemd/system/logrotate.service file I added:

Restart=always

The above addition kill logrotate service. From there I decided to undo my dirty work and by deleting Restart=always and systemctl daemon-reload && systemctl start logrotate

No luck.

Then I decided to investigate the syslog and see if I could find any clues, using:
#grep "logrotate" /var/log/syslog. This yielded a clue:

Dec 31 00:00:03 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 00:36:16 server1 clamd[3544]: Fri Dec 31 00:36:16 2021 -> ^File path check failure on: /var/tmp/systemd-private-2f8e6be5a16040adb29706b9e31ae841-logrotate.service-DbrlAK
Dec 31 00:37:31 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 12:51:17 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 13:00:58 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 13:05:25 server1 systemd[1]: logrotate.service: Succeeded.

Note: all the times where you see "Succeeded" are from me manually trying to start logrotate.

I read in this post on server fault that this can problem can be caused by logrotate trying to access logs outside of the var/log/ directory. And I though that this may be my problem, however I can't find any indicator of a log outside /var/log, except for the syslog error above:

reiteration:

Dec 31 00:36:16 server1 clamd[3544]: Fri Dec 31 00:36:16 2021 -> ^File path check failure on: /var/tmp/systemd-private-2f8e6be5a16040adb29706b9e31ae841-logrotate.service-DbrlAK

From I investigated clamd, but

#grep "log" /etc/clamav/clamd.conf 
LogSyslog false
LogFile /var/log/clamav/clamav.log

Yields, nothing. Does anyone know why logrotate won't start?

Score:1
jp flag

logrotate.service is supposed to be inactive. It doesn't run as a daemon but is triggered periodically by logrotate.timer, check systemctl status logrotate.timer.

Maestro223 avatar
cn flag
Ok... I was wondering about that... but prior to my editing logrotate.service it would always show as active.... It just appeared as if I had broken something. In any case, I also check logrotate.timer and it was/is working. so I guess accidentally repaired logrotate somehow.. Thanks for your feedback. Much appreciated... on to other bugs :-) Happy New Year!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.