We have been using the FreePBX distro for a couple of months now and noticed that performance seems to have gotten a bit sluggish. When we looked around we found the freepbx log file /tmp/freepbx_debug.log at 785 MB and growing. I checked our advanced settings and “Disable FreePBX debug Logging = True” so here is my question.
Isn’t there a way to turn the log file off?
Shouldn’t we prevent the file from growing forever? If it grows forever it would eventually bring the whole system down and most users are not even aware of this file.
Can we delete the file periodically without impacting the system?
On a box that is up but not yet carrying traffic the file has grown to 49M, there are thousands of lines of the following errors:
2011-Nov-03 11:11:02 /var/www/html/admin/libraries/xml2Array.class.php:59
[WARNING]: array_push(): Cannot add element to the array as the next element is already occupied
2011-Nov-04 13:08:12 /var/www/html/admin/modules/sysadmin/functions.inc/licensed.php:0
[WARNING]: No license for this product (‘PBXact’) - make sure zend_optimizer.license_path is properly configured in php.ini!
I deleted the file on one of my test boxes and it is recreated so there is no harm in deleting it. You could create a cron job to periodically delete the file.
Do not create a cron job to delete the file. Logrotate needs to be setup.
/etc/logrotate.conf
[vg2.xxx.net etc]# cat logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
minsize 1M
create 0664 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
The in logrote.d you should find the asterisk file
I agree that logrotate is the better solution. The cron job was just a quick and dirty way to get the file deleted.
I do not see anywhere in the logrotate config you posted above the rotates the file /tmp/freepbx_debug.log
In any event this still looks like a bug to me. Either logrotate is not setup to delete /tmp/freepbx_debug.log in the distro or /tmp/freepbx_debug.log is being written in /tmp rather than /var/log/asterisk.
The debug file itself rotates when it gets close to 2 GB in size since most systems have a per file size limit of 2GB. It looks like there is a bug in with setting debug to be off not working. We are looking into the issue and should have it solved soon.