FreePBX 14 RC - log files not rotating

Good afternoon,

Installed FreePBX 14 RC distro and all settings are default.
Looking at /var/log/asterisk/ , all of the log files are not being rotated even though they are set to in the GUI. Don’t have full.1 full.2, etc.

Setttings --> Asterisk Logfile Settings --> Log Rotation set to “Rotate”

Below are copies of /etc/logrotate.conf and /etc/logger.d/asterisk. Culprit is logger.d/asterisk?

Any guidance would be appreciated. Cheers

Copy of /etc/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

# use date as a suffix of the rotated file
dateext

# 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 and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
	minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.

Copy of /etc/logger.d/asterisk

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

/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
	notifempty
	sharedscripts
	create 0640 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 Sat May 20 04:52:55 UTC 2017

There is an open issue on this and a fully updated freepbx 14 should rotate most of its log files now. There are still a couple that still has issues.

1 Like

Please install the stable distro

Which ones?

My mistake. Should have updated all modules first.

Have upgraded from RC to 14.0.1.1.
Will check that log files are rotating and report back in a couple days.

Cheers

1 Like

Good afternoon,

After upgrade to 14.0.1.1, log rotation is still not functional:

Have upgraded to 14.0.1.4. Will continue to monitor for rotation.

Another machine running 12.0.76.4 and asterisk 11 rotates log correctly:

Here is it’s /etc/logrotate.d from the FreePBX 12 machine:

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

/var/spool/mail/asterisk
/var/log/asterisk/freepbx_debug
/var/log/asterisk/freepbx_dbug
/var/log/asterisk/freepbx.log
/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
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 Tue Apr 14 21:00:48 UTC 2015

How do I configure full log rotation?

Have you tried running them manually to see what the error is

Hi Andrew,

Here’s the result of running ‘logrotate -v /etc/logrotate.d/asterisk’ as root:

[[email protected] asterisk]# logrotate -v /etc/logrotate.d/asterisk
reading config file /etc/logrotate.d/asterisk
Allocating hash table for state file, size 15360 B

Handling 2 logs

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
error: skipping “/var/log/asterisk/queue_log” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.

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
error: skipping “/var/spool/mail/asterisk” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/log/asterisk/messages
error: skipping “/var/log/asterisk/messages” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/log/asterisk/event_log
error: skipping “/var/log/asterisk/event_log” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/log/asterisk/full
error: skipping “/var/log/asterisk/full” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/log/asterisk/dtmf
error: skipping “/var/log/asterisk/dtmf” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/log/asterisk/fail2ban
error: skipping “/var/log/asterisk/fail2ban” because parent directory has insecure permissions (It’s world writable or writable by group which is not “root”) Set “su” directive in config file to tell logrotate which user/group should be used for rotation.

Permissions of /etc/logrotate.d/asterisk to are user:group root:root 644

Cron jobs:

Sorry to dredge up an old thread, but on a fully updated FreePBX 14.0.1.36 machine, the log files in /var/log/asterisk are not rotating. Particularly zulu_out.log which is almost 3TB even though Zulu is not being used on this machine. Any advise would be appreciated.

There’s a current thread about Zulu logs not rotating.

https://community.freepbx.org/c/general-help

Perhaps you can hop on that one and see if the information there fulfills your needs (or if you can add to the discussion).

Thanks Dave for the link. Will follow that thread to see if there’s a resolution for Zulu or if I can contribute at all. I’ve posted logrotate file from zulu module there.

However, I’m still unclear why asterisk logs aren’t rotating. Do I need to modify /etc/logrotate.d/asterisk?
Cheers

You answered your own question.

You need to make sure the log directory ownership is correct. A ‘fwconsole chown’ (IIRC) should take care of that. If it doesn’t, it’s a bug and should be reported through the bug-tracker (Issues link above).

Add

su root asterisk

to the stanzas that fail.

Thank you dicko and Dave for your patience and advice. Permissions was the issue. Added su and user/group to config file and it appears to rotate properly after logrotate -f /etc/logrotate.d/asterisk. This is what happens when you put a chemist in charge of the switch. Cheers!

Disk is running high, peaked in and see a massive 19gb log file.

Here is my 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

# use date as a suffix of the rotated file
dateext

# 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 and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
    minsize 1M
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}

# system-specific logs may be also be configured here.'

And then my logrotate.d/asterisk

/var/log/asterisk/queue_log {
daily
missingok
rotate 30
notifempty
sharedscripts
create 0640 asterisk asterisk
}
/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
notifempty
sharedscripts
create 0640 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 Mon Oct 30 17:09:48 EDT 2017

Whats your Zulu version? If you are using Zulu 3 report send this to the email provided in the wiki

There’s a log rotate file specifically for Zulu. Please check that.

In /etc/logrotate.d ? There is my problem, I don’t have one for Zulu. Guess that is why the log didn’t rotate.

How do I get the “stock” file?

Is there one in the Zulu folder for the Zulu module

zulu log not rotating on FreePBX 14.0.1.36, Zulu module 14.0.2.13.

Logrotate file in /var/www/html/admin/modules/zulu/hooks/logrotate

#!/bin/bash

cat <<- EOF > /etc/logrotate.d/freepbx-zulu
/var/log/asterisk/zulu_*.log {
size 50M
missingok
rotate 5
notifempty
sharedscripts
create 0640 asterisk asterisk
su asterisk asterisk
postrotate
/usr/sbin/fwconsole pm2 --reload-logs -q
endscript
}
EOFf