Logrotate stops working

It looks like the logs didn’t rotate. And there is nothing in /var/lib/logrotate/logrotate.status

https://pastebin.freepbx.org/view/2b1d41bd

grep logrotate /var/log/messages

[root@freepbx ~]# grep logrotate /var/log/messages
Oct 25 03:12:01 freepbx logrotate: ALERT exited abnormally with [1]

i am having same issue it was good for a while but now it started again:
[root@freepbx ~]# grep logrotate /var/log/messages
Oct 24 03:29:03 freepbx logrotate: ALERT exited abnormally with [1]
Oct 25 03:47:01 freepbx logrotate: ALERT exited abnormally with [1]
Oct 26 03:41:02 freepbx logrotate: ALERT exited abnormally with [1]

Pragmatically I would just replace daily with size 10M in the asterisk logrotate file , that should take it out of cron world, if that works change 10M to whatever.

I’m assuming that you’re talking about the /etc/logrotate.d/asterisk file. What did you want me to replace the “daily” with 10M? My main concern is with the “full” file rotation (just because it’s the largest), but the “full” file has no specific configuration. Here are the contents of the /etc/logrorate.d/asterisk file :

/var/log/asterisk/queue_log {
daily
missingok
rotate 30
notifempty
sharedscripts
create 0640 asterisk asterisk
su asterisk asterisk
}

/var/spool/mail/asterisk {
daily
missingok
rotate 7
notifempty
sharedscripts
create 0660 asterisk mail
su asterisk mail
}

/var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban {
daily
missingok
rotate 7
notifempty
sharedscripts
create 0640 asterisk asterisk
su asterisk asterisk
postrotate
/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null
endscript
}
#This comment is to fix rpm file replacing
#Config file built on Thu Apr 22 07:27:05 UTC 2021

/var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full <--
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban 
.
.
.
>daily
<size 10M
.
.
.

I don’t use redhat based OS and it seems that they still use anacron / cron rather than systemd which is easier to troubleshoot.

I made the following additions (everything between and including the curly braces) to /etc/logrotate.d/asterisk on Oct 26th:
/var/log/asterisk/full {
size 10M
missingok
rotate 7
notifempty
sharedscripts
create 0640 asterisk asterisk
su asterisk asterisk
}

Now, here are my full logs:
[root@freepbx ~]# ls -l /var/log/asterisk/full*
-rw-r----- 1 asterisk asterisk 0 Oct 28 03:09 /var/log/asterisk/full
-rw-r----- 1 asterisk asterisk 87047192 Oct 25 16:07 /var/log/asterisk/full.1
-rw-r----- 1 asterisk asterisk 73806719 Oct 19 13:36 /var/log/asterisk/full.2
-rw-r----- 1 asterisk asterisk 599871 Oct 10 03:20 /var/log/asterisk/full-20211010

It doesn’t look like my full log file is being written to at all.

And the logrotate.status file is empty:
[root@freepbx ~]# ls -l /var/lib/logrotate/logrotate.status
-rw-r–r-- 1 root root 0 Oct 25 16:47 /var/lib/logrotate/logrotate.status

It seems like my /etc/logrotate.d/asterisk change made it worse.

Any thoughts on what is wrong or what to try next?

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.