FreePBX 14 RC - log files not rotating

Is this in the logrotate location on the system

Eg is it here /etc/logrotate.d/freepbx-zulu

No, I only see that file in /var/www/html/admin/modules/zulu/hooks/

Correct! There is nothing that references Zulu in /etc/logrotate.d

We have a client that does not use the zulu plugin. I noticed that in the /var/log/asterisk/zulu_forever.log & zulu_out.log is taking 8.71GB of space. I am seeing the last change was a few minutes ago so it seems to be writing to the files. Has anyone come across this and or can I remove those files??

zulu_

Please run:

ps aux | grep logrotate

Hey Andrew thanks for the help with this. I ran the command and it came back with.

[root@ ~]# ps aux | grep logrotate
root 3555 0.0 0.0 103244 888 pts/0 S+ 16:48 0:00 grep logrotate

Now run

/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf -d

Output

[root@ ~]# /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf -d
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apcupsd
reading config info for /var/log/apcupsd.events
reading config file asterisk
reading config info for /var/log/asterisk/queue_log
reading config info for /var/log/asterisk/freepbx_dbug
reading config info for /var/log/asterisk/prosody_debug.log
/var/log/asterisk/prosody.log
/var/log/asterisk/ucp_err.log
/var/log/asterisk/ucp_forever.log
/var/log/asterisk/ucp_out.log
/var/log/asterisk/freepbx_debug
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log
reading config info for /var/spool/mail/asterisk
/var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban
reading config file dracut
reading config info for /var/log/dracut.log
reading config file fail2ban
reading config info for /var/log/fail2ban.log
reading config file freepbx-core
error: freepbx-core:1 duplicate log entry for /var/log/asterisk/freepbx_dbug
error: found error in /var/log/asterisk/freepbx_dbug, skipping
removing last 1 log configs
error: freepbx-core:9 duplicate log entry for /var/log/asterisk/freepbx_debug
error: found error in /var/log/asterisk/freepbx_debug
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log, skipping
removing last 1 log configs
reading config file freepbx-mysqld
reading config info for /var/log/mysql/mysql.log
reading config file freepbx-restapps
reading config info for /var/log/asterisk/restapps_err.log
/var/log/asterisk/restapps_forever.log
/var/log/asterisk/restapps_out.log
reading config file freepbx-zulu
reading config info for /var/log/asterisk/zulu_err.log
/var/log/asterisk/zulu_forever.log
/var/log/asterisk/zulu_out.log
reading config file httpd
reading config info for /var/log/httpd/log
reading config file mysqld
reading config file radiusd
reading config info for /var/log/radius/radacct/
/detail
reading config info for /var/log/radius/checkrad.log
reading config info for /var/log/radius/radius.log
reading config info for /var/log/radius/radutmp
reading config info for /var/log/radius/radwtmp
reading config info for /var/log/radius/sqltrace.sql
reading config file syslog
reading config info for /var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler

reading config file vsftpd
reading config info for /var/log/vsftpd.log
reading config info for /var/log/xferlog
reading config file yum
reading config info for /var/log/yum.log
reading config info for /var/log/wtmp
reading config info for /var/log/btmp
error: error creating state file /var/lib/logrotate/logrotate.status: No such file or directory

Handling 25 logs

rotating pattern: /var/log/apcupsd.events weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apcupsd.events
log does not need rotating

rotating pattern: /var/log/asterisk/queue_log after 1 days (30 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/asterisk/queue_log
log does not need rotating

rotating pattern: /var/log/asterisk/freepbx_dbug 524288000 bytes (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/asterisk/freepbx_dbug
log /var/log/asterisk/freepbx_dbug does not exist – skipping

rotating pattern: /var/log/asterisk/prosody_debug.log
/var/log/asterisk/prosody.log
/var/log/asterisk/ucp_err.log
/var/log/asterisk/ucp_forever.log
/var/log/asterisk/ucp_out.log
/var/log/asterisk/freepbx_debug
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log 104857600 bytes (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/asterisk/prosody_debug.log
log /var/log/asterisk/prosody_debug.log does not exist – skipping
considering log /var/log/asterisk/prosody.log
log does not need rotating
considering log /var/log/asterisk/ucp_err.log
log /var/log/asterisk/ucp_err.log does not exist – skipping
considering log /var/log/asterisk/ucp_forever.log
log /var/log/asterisk/ucp_forever.log does not exist – skipping
considering log /var/log/asterisk/ucp_out.log
log /var/log/asterisk/ucp_out.log does not exist – skipping
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 does not need rotating
considering log /var/log/asterisk/freepbx_security.log
log does not need rotating

rotating pattern: /var/spool/mail/asterisk
/var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full
/var/log/asterisk/dtmf
/var/log/asterisk/fail2ban after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/spool/mail/asterisk
log does not need rotating
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 does not need rotating
considering log /var/log/asterisk/dtmf
log /var/log/asterisk/dtmf does not exist – skipping
considering log /var/log/asterisk/fail2ban
log does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/dracut.log 1048576 bytes (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/dracut.log
log does not need rotating

rotating pattern: /var/log/fail2ban.log 30720 bytes (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/fail2ban.log
log does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/asterisk/freepbx_dbug weekly (4 rotations)
empty log files are rotated, old logs are removed

rotating pattern: /var/log/asterisk/freepbx_debug
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log weekly (4 rotations)
empty log files are rotated, old logs are removed

rotating pattern: /var/log/mysql/mysql.log after 1 days (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/mysql/mysql.log
log /var/log/mysql/mysql.log does not exist – skipping
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/asterisk/restapps_err.log
/var/log/asterisk/restapps_forever.log
/var/log/asterisk/restapps_out.log 104857600 bytes (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/asterisk/restapps_err.log
log does not need rotating
considering log /var/log/asterisk/restapps_forever.log
log does not need rotating
considering log /var/log/asterisk/restapps_out.log
log does not need rotating

rotating pattern: /var/log/asterisk/zulu_err.log
/var/log/asterisk/zulu_forever.log
/var/log/asterisk/zulu_out.log 104857600 bytes (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/asterisk/zulu_err.log
log does not need rotating
considering log /var/log/asterisk/zulu_forever.log
log does not need rotating
considering log /var/log/asterisk/zulu_out.log
log does not need rotating

rotating pattern: /var/log/httpd/*log weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/httpd/access_log
log does not need rotating
considering log /var/log/httpd/error_log
log does not need rotating
considering log /var/log/httpd/ssl_access_log
log does not need rotating
considering log /var/log/httpd/ssl_error_log
log does not need rotating
considering log /var/log/httpd/ssl_request_log
log does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/radius/radacct//detail monthly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/radacct/
/detail
log /var/log/radius/radacct/*/detail does not exist – skipping

rotating pattern: /var/log/radius/checkrad.log monthly (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 monthly (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
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/radius/radutmp monthly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/radius/radutmp
log /var/log/radius/radutmp does not exist – skipping

rotating pattern: /var/log/radius/radwtmp monthly (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 monthly (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/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
weekly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/cron
log does not need rotating
considering log /var/log/maillog
log does not need rotating
considering log /var/log/messages
log does not need rotating
considering log /var/log/secure
log does not need rotating
considering log /var/log/spooler
log does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/vsftpd.log weekly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/vsftpd.log
log does not need rotating

rotating pattern: /var/log/xferlog weekly (4 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/yum.log yearly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/yum.log
log does not need rotating

rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
considering log /var/log/wtmp
log does not need rotating

rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
log does not need rotating
error: could not read state file, will not attempt to write into it

Everything should be rotated now.

Okay wonderful. So when the next time it rotates, will it purge the oldest data in the log?

It should have already done that.

What I find which for works well for us is having log files compressed:
rw-r----- 1 asterisk asterisk 12749999 Apr 8 19:11 fail2ban
-rw-rw-r-- 1 asterisk asterisk 906958 Apr 5 03:48 fail2ban-20180405.gz
-rw-r----- 1 asterisk asterisk 820737 Apr 6 03:33 fail2ban-20180406.gz
-rw-r----- 1 asterisk asterisk 746336 Apr 7 03:20 fail2ban-20180407.gz

-rw-r----- 1 asterisk asterisk 23503744 Apr 8 19:18 full
-rw-rw-r-- 1 asterisk asterisk 1616994 Apr 5 03:48 full-20180405.gz
-rw-r----- 1 asterisk asterisk 1074308 Apr 6 03:33 full-20180406.gz

vim /etc/logrotate.conf

uncomment compress…

uncomment this if you want your log files compressed

compress

Also changed /etc/logrotate.d/asterisk and added ‘compress’

so it looks like:

/var/spool/mail/asterisk
/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
compress
notifempty
sharedscripts
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null
endscript
}

Please add to your post how to use zcat to read those files or get a lot of very confused users who can’t look at (cat) them after doing what you reasonably suggest.

2 Likes

Hi Dicko, what I do if I happen to need one of the .gz files is just cp filename.gz /tmp and then gunzip -d filename.gz followed by either vim filename or less filename.

With vim one can do a lot as vim is an extremely good editor.

Yeah one can use zcat but all it does is spew the entire content. One should read the man page i.e. man zcat to see the available options.

While one is reading manuals, one might also include zgrep, and zmore or zless ,

I personally have never yet found a legal reason to edit a log file.

Hey Dicko, who is talking about legal stuff??
The topic was log files not rotating. All I mentioned was a way to compress the log files to save a lot of disk real estate.

We host and manage FreePBX servers for businesses and as such they are not built with a huge amount of space. If the files are compressed /var doesn’t get filled up.

And hopefully you know how to save a little more in your /tmp directory :slight_smile: , I have no problem with compression and do it all the time. But merely pointing out the useful tools you will need if you do that.

1 Like

i never saw a resolution to not having the freepbx-zulu logrotate file. i see it should have been created by the hook in the zulu module, but the only freepbx logrotate i have is freepbx-core. from other posts, it seems that ucp and restapps should have logrotate files as well. does /etc/logrotate.d need perms opened up? and how can i retrigger module hooks?