Logrotate stops working

I actually don’t see where the original runs. I looked in /var/spool/cron/root and /var/spool/cron/asterisk and I don’t see the logrotate command either file.
I don’t mind if it runs twice per day. Two times is better than none. If the logrotate fails again in a few days, I’ll just stick the logrotate in /var/spool/cron/root.

cron jobs are also run from the configs in /etc/cron.*

Ok, got it: /etc/cron.daily/logrotate

and .daily .weekly .monthly etc to clean up , update whatever, I generally use those jobs for system specific jobs, user specific ones of course where they are.

I checked today and found that my logs are still not rotating, even when I manually run “logrotate -f -v /etc/logrotate.conf”:

[root@freepbx ~]# ls -l /var/log/asterisk/full*
-rw-r----- 1 asterisk asterisk 74616863 Oct 25 08:17 /var/log/asterisk/full
-rw-r----- 1 asterisk asterisk 73806719 Oct 19 13:36 /var/log/asterisk/full.1
-rw-r----- 1 asterisk asterisk 7112689 Oct 8 03:22 /var/log/asterisk/full-2021 1008
-rw-r----- 1 asterisk asterisk 24702273 Oct 9 03:25 /var/log/asterisk/full-2021 1009
-rw-r----- 1 asterisk asterisk 599871 Oct 10 03:20 /var/log/asterisk/full-2021 1010
-rw-r----- 1 asterisk asterisk 348038 Oct 11 03:24 /var/log/asterisk/full-2021 1011
-rw-r----- 1 asterisk asterisk 16249144 Oct 12 03:28 /var/log/asterisk/full-2021 1012
-rw-r----- 1 asterisk asterisk 18314454 Oct 13 03:07 /var/log/asterisk/full-2021 1013
-rw-r----- 1 asterisk asterisk 20116047 Oct 14 03:32 /var/log/asterisk/full-2021 1014
[root@freepbx ~]# logrotate -f -v /etc/logrotate.conf
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apcupsd
reading config file asterisk
reading config file bootlog
reading config file chrony
reading config file fail2ban
reading config file freepbx-core
reading config file freepbx-qcallback
reading config file freepbx-restapps
reading config file freepbx-sangomacrm
reading config file freepbx-ucp
reading config file freepbx-zulu
reading config file httpd
reading config file iscsiuiolog
reading config file mariadb
reading config file mongodb
reading config file oc_logrotate
reading config file pms
reading config file psacct
reading config file radiusd
reading config file redis
reading config file sangomaconnect
reading config file smartoffice
reading config file syslog
reading config file vsftpd
reading config file wpa_supplicant
reading config file yum
Allocating hash table for state file, size 15360 B

Handling 37 logs

rotating pattern: /var/log/apcupsd.events forced from command line (14 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apcupsd.events
log /var/log/apcupsd.events does not exist – skipping

rotating pattern: /var/log/asterisk/queue_log forced from command line (30 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/queue_log
log does not need rotating (log is empty)switching euid to 0 and egid to 0

rotating pattern: /var/spool/mail/asterisk forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 12
considering log /var/spool/mail/asterisk
log does not need rotating (log is empty)switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/messages
log /var/log/asterisk/messages does not exist – skipping
considering log /var/log/asterisk/event_log
log /var/log/asterisk/event_log does not exist – skipping
considering log /var/log/asterisk/full
log needs rotating
considering log /var/log/asterisk/dtmf
log /var/log/asterisk/dtmf does not exist – skipping
considering log /var/log/asterisk/fail2ban
log needs rotating
rotating log /var/log/asterisk/full, log->rotateCount is 7
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
rotating log /var/log/asterisk/fail2ban, log->rotateCount is 7
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
removing /var/log/asterisk/fail2ban-20211007
removing old log /var/log/asterisk/fail2ban-20211007
error: error opening /var/log/asterisk/fail2ban-20211007: Permission denied
switching euid to 0 and egid to 0

rotating pattern: /var/log/boot.log
forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/boot.log
log does not need rotating (log is empty)
rotating pattern: /var/log/chrony/.log forced from command line (14 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/chrony/
.log
log /var/log/chrony/*.log does not exist – skipping
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/fail2ban.log forced from command line (14 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/fail2ban.log
log needs rotating
rotating log /var/log/fail2ban.log, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/fail2ban.log to /var/log/fail2ban.log-20211025
creating new /var/log/fail2ban.log mode = 0600 uid = 0 gid = 0
running postrotate script
ERROR Unable to contact server. Is it running?

rotating pattern: /var/log/asterisk/freepbx_dbug forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/freepbx_dbug
log /var/log/asterisk/freepbx_dbug does not exist – skipping
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/freepbx_debug
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/freepbx_debug
log /var/log/asterisk/freepbx_debug does not exist – skipping
considering log /var/log/asterisk/freepbx.log
log needs rotating
considering log /var/log/asterisk/freepbx_security.log
log needs rotating
rotating log /var/log/asterisk/freepbx.log, log->rotateCount is 7
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
rotating log /var/log/asterisk/freepbx_security.log, log->rotateCount is 7
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/asterisk/freepbx.log to /var/log/asterisk/freepbx.log-20211025
creating new /var/log/asterisk/freepbx.log mode = 0664 uid = 995 gid = 995
renaming /var/log/asterisk/freepbx_security.log to /var/log/asterisk/freepbx_security.log-20211025
creating new /var/log/asterisk/freepbx_security.log mode = 0664 uid = 995 gid = 995
removing old log /var/log/asterisk/freepbx.log-20210824
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/core-fastagi_*.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/core-fastagi_err.log
log does not need rotating (log is empty)considering log /var/log/asterisk/core-fastagi_out.log
log needs rotating
rotating log /var/log/asterisk/core-fastagi_out.log, log->rotateCount is 5
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/asterisk/core-fastagi_out.log to /var/log/asterisk/core-fastagi_out.log-20211025
creating new /var/log/asterisk/core-fastagi_out.log mode = 0664 uid = 995 gid = 995
running postrotate script
switching euid to 0 and egid to 0
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/qcallback_.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/qcallback_
.log
log /var/log/asterisk/qcallback_*.log does not exist – skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/restapps_*.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/restapps_err.log
log does not need rotating (log is empty)considering log /var/log/asterisk/restapps_out.log
log needs rotating
rotating log /var/log/asterisk/restapps_out.log, log->rotateCount is 5
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/asterisk/restapps_out.log to /var/log/asterisk/restapps_out.log-20211025
creating new /var/log/asterisk/restapps_out.log mode = 0640 uid = 995 gid = 995
running postrotate script
switching euid to 0 and egid to 0
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/dpmaapps.log forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/dpmaapps.log
log /var/log/asterisk/dpmaapps.log does not exist – skipping
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/sangomacrm*.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/sangomacrm*.log
log /var/log/asterisk/sangomacrm*.log does not exist – skipping
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/ucp_*.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/ucp_err.log
log needs rotating
considering log /var/log/asterisk/ucp_out.log
log needs rotating
rotating log /var/log/asterisk/ucp_err.log, log->rotateCount is 5
Converted ’ -%Y%m%d%s’ -> ‘-%Y%m%d%s’
dateext suffix ‘-202110251635164448’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
rotating log /var/log/asterisk/ucp_out.log, log->rotateCount is 5
Converted ’ -%Y%m%d%s’ -> ‘-%Y%m%d%s’
dateext suffix ‘-202110251635164448’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/asterisk/ucp_err.log to /var/log/asterisk/ucp_err.log-202110251635164448
creating new /var/log/asterisk/ucp_err.log mode = 0640 uid = 995 gid = 995
renaming /var/log/asterisk/ucp_out.log to /var/log/asterisk/ucp_out.log-202110251635164448
creating new /var/log/asterisk/ucp_out.log mode = 0640 uid = 995 gid = 995
running postrotate script
switching euid to 0 and egid to 0
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/zulu_*.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/zulu_out.log
log does not need rotating (log is empty)not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0

rotating pattern: /var/log/httpd/*log forced from command line (14 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/httpd/access_log
log needs rotating
considering log /var/log/httpd/error_log
log needs rotating
considering log /var/log/httpd/ssl_access_log
log does not need rotating (log is empty)considering log /var/log/httpd/ssl_error_log
log needs rotating
considering log /var/log/httpd/ssl_request_log
log does not need rotating (log is empty)rotating log /var/log/httpd/access_log, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
rotating log /var/log/httpd/error_log, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/httpd/error_log-20211025 already exists, skipping rotation
rotating log /var/log/httpd/ssl_error_log, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/httpd/ssl_error_log-20211025 already exists, skipping rotation

rotating pattern: /var/log/iscsiuio.log forced from command line (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/iscsiuio.log
log /var/log/iscsiuio.log does not exist – skipping
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/mongodb/*.log forced from command line (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/mongodb/mongod.log
log needs rotating
rotating log /var/log/mongodb/mongod.log, log->rotateCount is 10
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
compressing log with: /bin/gzip
copying /var/log/mongodb/mongod.log to /var/log/mongodb/mongod.log-20211025
truncating /var/log/mongodb/mongod.log
running postrotate script
removing old log /var/log/mongodb/mongod.log-20210829.gz

rotating pattern: /var/log/asterisk/oracle_connector.log
/var/log/asterisk/oracle_engine_err.log
/var/log/asterisk/oracle_engine_out.log forced from command line (15 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/oracle_connector.log
log /var/log/asterisk/oracle_connector.log does not exist – skipping
considering log /var/log/asterisk/oracle_engine_err.log
log /var/log/asterisk/oracle_engine_err.log does not exist – skipping
considering log /var/log/asterisk/oracle_engine_out.log
log /var/log/asterisk/oracle_engine_out.log does not exist – skipping
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/pms.log forced from command line (15 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/pms.log
log does not need rotating (log is empty)switching euid to 0 and egid to 0

rotating pattern: /var/account/pacct forced from command line (31 rotations)
empty log files are not rotated, old logs are removed
considering log /var/account/pacct
log does not need rotating (log is empty)
rotating pattern: /var/log/radius/radacct//detail forced from command line (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/radacct/
/detail

rotating pattern: /var/log/radius/checkrad.log forced from command line (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/checkrad.log
log /var/log/radius/checkrad.log does not exist – skipping

rotating pattern: /var/log/radius/radius.log forced from command line (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/radius.log
log /var/log/radius/radius.log does not exist – skipping

rotating pattern: /var/log/radius/radwtmp forced from command line (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/radwtmp
log /var/log/radius/radwtmp does not exist – skipping

rotating pattern: /var/log/radius/sqltrace.sql forced from command line (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/sqltrace.sql
log /var/log/radius/sqltrace.sql does not exist – skipping

rotating pattern: /var/log/redis/*.log forced from command line (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/redis/redis.log
log needs rotating
rotating log /var/log/redis/redis.log, log->rotateCount is 10
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
compressing log with: /bin/gzip
copying /var/log/redis/redis.log to /var/log/redis/redis.log-20211025
truncating /var/log/redis/redis.log
removing old log /var/log/redis/redis.log-20210829.gz

rotating pattern: /var/log/asterisk/sangomaconnect.log forced from command line (10 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/sangomaconnect.log
log /var/log/asterisk/sangomaconnect.log does not exist – skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/iot-server.log forced from command line (10 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/iot-server.log
log does not need rotating (log is empty)not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0

rotating pattern: /var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
forced from command line (14 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/cron
log needs rotating
considering log /var/log/maillog
log needs rotating
considering log /var/log/messages
log needs rotating
considering log /var/log/secure
log needs rotating
considering log /var/log/spooler
log needs rotating
rotating log /var/log/cron, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/cron-20211025 already exists, skipping rotation
rotating log /var/log/maillog, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/maillog-20211025 already exists, skipping rotation
rotating log /var/log/messages, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/messages-20211025 already exists, skipping rotation
rotating log /var/log/secure, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/secure-20211025 already exists, skipping rotation
rotating log /var/log/spooler, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/spooler-20211025 already exists, skipping rotation

rotating pattern: /var/log/vsftpd.log forced from command line (14 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/vsftpd.log
log needs rotating
rotating log /var/log/vsftpd.log, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
destination /var/log/vsftpd.log-20211025 already exists, skipping rotation

rotating pattern: /var/log/xferlog forced from command line (14 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/xferlog
log /var/log/xferlog does not exist – skipping

rotating pattern: /var/log/wpa_supplicant.log forced from command line (14 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/wpa_supplicant.log
log needs rotating
rotating log /var/log/wpa_supplicant.log, log->rotateCount is 14
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/wpa_supplicant.log to /var/log/wpa_supplicant.log-20211025
creating new /var/log/wpa_supplicant.log mode = 0600 uid = 0 gid = 0

rotating pattern: /var/log/yum.log forced from command line (14 rotations)
empty log files are not rotated, log files >= 30720 are rotated earlier, old logs are removed
considering log /var/log/yum.log
log does not need rotating (log is empty)
rotating pattern: /var/log/wtmp forced from command line (1 rotations)
empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
considering log /var/log/wtmp
log needs rotating
rotating log /var/log/wtmp, log->rotateCount is 1
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/wtmp to /var/log/wtmp-20211025
creating new /var/log/wtmp mode = 0664 uid = 0 gid = 22
removing old log /var/log/wtmp-20211007

rotating pattern: /var/log/btmp forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
log needs rotating
rotating log /var/log/btmp, log->rotateCount is 1
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/btmp to /var/log/btmp-20211025
creating new /var/log/btmp mode = 0600 uid = 0 gid = 22
removing old log /var/log/btmp-20211007
[root@freepbx ~]# ls -l /var/log/asterisk/full*
-rw-r----- 1 asterisk asterisk 74648872 Oct 25 08:19 /var/log/asterisk/full
-rw-r----- 1 asterisk asterisk 73806719 Oct 19 13:36 /var/log/asterisk/full.1
-rw-r----- 1 asterisk asterisk 7112689 Oct 8 03:22 /var/log/asterisk/full-20211008
-rw-r----- 1 asterisk asterisk 24702273 Oct 9 03:25 /var/log/asterisk/full-20211009
-rw-r----- 1 asterisk asterisk 599871 Oct 10 03:20 /var/log/asterisk/full-20211010
-rw-r----- 1 asterisk asterisk 348038 Oct 11 03:24 /var/log/asterisk/full-20211011
-rw-r----- 1 asterisk asterisk 16249144 Oct 12 03:28 /var/log/asterisk/full-20211012
-rw-r----- 1 asterisk asterisk 18314454 Oct 13 03:07 /var/log/asterisk/full-20211013
-rw-r----- 1 asterisk asterisk 20116047 Oct 14 03:32 /var/log/asterisk/full-20211014

Does anyone have any idea of what I should do next? I would certainly appreciate any input!

Reboot

I have rebooted in the past and and it seem to help the logrotate work for a bit (maybe a week), but then it stops working and the logs don’t get rotated any longer. I am hoping to come up with a better long-term solution than frequent rebooting.

Could you please ‘pastebin’ just

logrotate -f -v -d /etc/logrotate.d/asterisk

[root@freepbx ~]# logrotate -f -v -d /etc/logrotate.d/asterisk
reading config file /etc/logrotate.d/asterisk
Allocating hash table for state file, size 15360 B

Handling 3 logs

rotating pattern: /var/log/asterisk/queue_log forced from command line (30 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/queue_log
log does not need rotating (log is empty)switching euid to 0 and egid to 0

rotating pattern: /var/spool/mail/asterisk forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 12
considering log /var/spool/mail/asterisk
log does not need rotating (log is empty)switching euid to 0 and egid to 0

rotating pattern: /var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 995 and egid to 995
considering log /var/log/asterisk/messages
log /var/log/asterisk/messages does not exist – skipping
considering log /var/log/asterisk/event_log
log /var/log/asterisk/event_log does not exist – skipping
considering log /var/log/asterisk/full
log needs rotating
considering log /var/log/asterisk/dtmf
log /var/log/asterisk/dtmf does not exist – skipping
considering log /var/log/asterisk/fail2ban
log needs rotating
rotating log /var/log/asterisk/full, log->rotateCount is 7
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/asterisk/full.7 to /var/log/asterisk/full.8 (rotatecount 7, logstart 1, i 7),
renaming /var/log/asterisk/full.6 to /var/log/asterisk/full.7 (rotatecount 7, logstart 1, i 6),
renaming /var/log/asterisk/full.5 to /var/log/asterisk/full.6 (rotatecount 7, logstart 1, i 5),
renaming /var/log/asterisk/full.4 to /var/log/asterisk/full.5 (rotatecount 7, logstart 1, i 4),
renaming /var/log/asterisk/full.3 to /var/log/asterisk/full.4 (rotatecount 7, logstart 1, i 3),
renaming /var/log/asterisk/full.2 to /var/log/asterisk/full.3 (rotatecount 7, logstart 1, i 2),
renaming /var/log/asterisk/full.1 to /var/log/asterisk/full.2 (rotatecount 7, logstart 1, i 1),
renaming /var/log/asterisk/full.0 to /var/log/asterisk/full.1 (rotatecount 7, logstart 1, i 0),
rotating log /var/log/asterisk/fail2ban, log->rotateCount is 7
dateext suffix ‘-20211025’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/asterisk/fail2ban.7 to /var/log/asterisk/fail2ban.8 (rotatecount 7, logstart 1, i 7),
renaming /var/log/asterisk/fail2ban.6 to /var/log/asterisk/fail2ban.7 (rotatecount 7, logstart 1, i 6),
renaming /var/log/asterisk/fail2ban.5 to /var/log/asterisk/fail2ban.6 (rotatecount 7, logstart 1, i 5),
renaming /var/log/asterisk/fail2ban.4 to /var/log/asterisk/fail2ban.5 (rotatecount 7, logstart 1, i 4),
renaming /var/log/asterisk/fail2ban.3 to /var/log/asterisk/fail2ban.4 (rotatecount 7, logstart 1, i 3),
renaming /var/log/asterisk/fail2ban.2 to /var/log/asterisk/fail2ban.3 (rotatecount 7, logstart 1, i 2),
renaming /var/log/asterisk/fail2ban.1 to /var/log/asterisk/fail2ban.2 (rotatecount 7, logstart 1, i 1),
renaming /var/log/asterisk/fail2ban.0 to /var/log/asterisk/fail2ban.1 (rotatecount 7, logstart 1, i 0),
renaming /var/log/asterisk/full to /var/log/asterisk/full.1
creating new /var/log/asterisk/full mode = 0640 uid = 995 gid = 995
renaming /var/log/asterisk/fail2ban to /var/log/asterisk/fail2ban.1
creating new /var/log/asterisk/fail2ban mode = 0640 uid = 995 gid = 995
running postrotate script
running script with arg /var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban : "
/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null
"
removing old log /var/log/asterisk/full.8
error: error opening /var/log/asterisk/full.8: No such file or directory
switching euid to 0 and egid to 0
[root@freepbx ~]# ls -l /var/log/asterisk/full*
-rw-r----- 1 asterisk asterisk 86926126 Oct 25 15:53 /var/log/asterisk/full
-rw-r----- 1 asterisk asterisk 73806719 Oct 19 13:36 /var/log/asterisk/full.1
-rw-r----- 1 asterisk asterisk 7112689 Oct 8 03:22 /var/log/asterisk/full-20211008
-rw-r----- 1 asterisk asterisk 24702273 Oct 9 03:25 /var/log/asterisk/full-20211009
-rw-r----- 1 asterisk asterisk 599871 Oct 10 03:20 /var/log/asterisk/full-20211010
-rw-r----- 1 asterisk asterisk 348038 Oct 11 03:24 /var/log/asterisk/full-20211011
-rw-r----- 1 asterisk asterisk 16249144 Oct 12 03:28 /var/log/asterisk/full-20211012
-rw-r----- 1 asterisk asterisk 18314454 Oct 13 03:07 /var/log/asterisk/full-20211013
-rw-r----- 1 asterisk asterisk 20116047 Oct 14 03:32 /var/log/asterisk/full-20211014
[root@freepbx ~]#

With the -d option nothing gets changed, but the ‘debug’ shows that it would have done.

Please use pastebin when posting, it’s so much less work for us, even if it’s a little more for you .

I’m so sorry! Here is the URL: https://pastebin.freepbx.org/view/97ec31f7

Now do it over without the -d

man logrotate

Also ls -lsrt /var/log/ to see if other logs are being rotated

That works. Why does it work now when it didn’t work before? It’s almost like the -d resets something that allows the next logrotate to work?

https://pastebin.freepbx.org/view/7a6971d2

No, not the -d :slight_smile: , how and when are you calling logrotate and as who?

When I’m running logrotate manually, I am logged into root. (This is a FreePBX distro running Sangoma Linux).
When logrotate is running automatically, it is running via /etc/cron.daily/logrotate.

And what is in that file, at the risk of being whimisical your rotations might be circular

Whether it is whimsical or not, I appreciate your help!

[root@freepbx ~]# more /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate “ALERT exited abnormally with [$EXITVALUE]”
fi
exit 0

Then /var/log/messages would contain any errors, you might want to add a -v to the call to logrotate and make sure to check your mail.

cat /var/lib/logrotate/status

for the a synopsis of the last run

I added the -v to the /etc/cron.daily/logrotate. I’ll post the output of /var/lib/logrotate/logrotate.status tomorrow. Thanks!

If you empty /var/lib/logrotate/status (not delete) then tomorrow it would be very explicit.