SOLVED Incredible PBX 13-13 not rotating Asterisk log files

jeffmac

Guru
Joined
Jan 16, 2008
Messages
230
Reaction score
9
I have an Incredible PBX 13-13 up and running, but I noticed that the Asterisk logfiles are not "rotating".

I checked the Log File Settings, and I can see that "Rotate" is set (vs. Sequential, or Timestamp). After checking that I waited a few days, but the log never rotated.

So then I looked at logrotate.d, but noticed there was no reference to asterisk. So I lifted the asterisk file from logrotate.d on an older system, and copied it into logrotate.d. I didn't see anything in it that I thought needed to be different for my 13-13 system so I made no changes:

Code:
/var/log/asterisk/*log {
   missingok
   rotate 5
   weekly
   create 0640 asterisk asterisk
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}

/var/log/asterisk/full {
   missingok
   rotate 5
   daily
   create 0640 asterisk asterisk
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}

/var/log/asterisk/cdr-csv/*csv {
  missingok
  rotate 5
  monthly
  create 0640 asterisk asterisk
}

/var/log/atftp.log {
  missingok
  rotate 5
  monthly
  create 0640 nobody nobody

I still have not seen a logrotate occur. /var/log/asterisk/full still has its oldest entries (from 11/23).

I would appreciate any pointers.

Jeff
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
call logrotate with -fv (force,verbose)

logrotate -vf /etc/logrotate.d/asterisk

It should display anything abnormal.
 
Last edited by a moderator:

jeffmac

Guru
Joined
Jan 16, 2008
Messages
230
Reaction score
9
Ok, I issued the logrotate command dicko suggested. For each of the 4 log files for asterisk it has he same response:
Code:
rotating pattern: /var/log/asterisk/full  forced from command line (5 rotations)
empty log files are rotated, old logs are removed
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.

now /var/log/asterisk is owned by asterisk, and writable by the asterisk group, but not by non group members (ie: 775), but /var/log is owned by root, and not writable except by owner (no group or user writable - ie: 755). These are the same permissions on my older Centos (5 or maybe 6?) which has worked just fine for several years.

So is setting a "su" directive the answer, and what should it be set to? And is this something that has changed with Centos 7?

Jeff
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
Ok, I issued the logrotate command dicko suggested. For each of the 4 log files for asterisk it has he same response:
Code:
rotating pattern: /var/log/asterisk/full  forced from command line (5 rotations)
empty log files are rotated, old logs are removed
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.

now /var/log/asterisk is owned by asterisk, and writable by the asterisk group, but not by non group members (ie: 775), but /var/log is owned by root, and not writable except by owner (no group or user writable - ie: 755). These are the same permissions on my older Centos (5 or maybe 6?) which has worked just fine for several years.

So is setting a "su" directive the answer, and what should it be set to? And is this something that has changed with Centos 7?

Jeff


yes adding the directive

su asterisk asterisk

should work
 

jeffmac

Guru
Joined
Jan 16, 2008
Messages
230
Reaction score
9
Thanks, dicko, I had just finished a google search on this and discovered exactly what you suggested, and by the way it IS a Centos 7 thing because of the level of logrotate included at that release (it said).

I tried it and it DOES work.

@NerdUno - is building the asterisk entry for logrotate.d an IncrediblePBX function or an asterisk install function, or something different yet?

Jeff
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
The log is generated during the Asterisk compile process. It's not something we touched.

Sorry to be dense. What's the fix and where does it go??
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
ass

add

su asterisk asterisk

to each stanza in

/etc/logrotate.d/asterisk
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
@dicko: Thanks.

So here's the patch to get the Asterisk full log squared away. We'll add it to the Incredible PBX 13-13 installer and push it out through the update utility as well:
Code:
echo "/var/log/asterisk/full {
   missingok
   rotate 8
   daily
   su asterisk asterisk
   create 0640 asterisk asterisk
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}" > /etc/logrotate.d/asterisk
logrotate -vf /etc/logrotate.d/asterisk
 
Last edited:

slbailey

New Member
Joined
Dec 1, 2008
Messages
12
Reaction score
1
@dicko: Thanks.

So here's the patch to get the Asterisk full log squared away. We'll add it to the Incredible PBX 13-13 installer and push it out through the update utility as well:
Code:
echo "/var/log/asterisk/full {
   missingok
   rotate 8
   daily
   su asterisk asterisk
   create 0640 asterisk asterisk
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}" > /etc/logrotate.d/asterisk
logrotate -vf /etc/logrotate.d/asterisk

FYI, adding su asterisk asterisk to the 13-13 installer gives the following error:

error: asterisk:5 unknown option 'su' -- ignoring line
error: asterisk:5 unexpected text
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
You have to copy the entire block of commands. su is a log rotate command, not a bash command.
 

phonebuff

Guru
Joined
Feb 7, 2008
Messages
1,115
Reaction score
129
So in a new build on RentPBX I am seeing the su error. An the asterisk file looks right based on what's where --

/etc/cron.daily/logrotate:

error: asterisk:5 unknown option 'su' -- ignoring line
error: asterisk:5 unexpected text

CentOS 6.10
-- Asterisk 13.21.1
-- Incred 13.0.120.10
---------------------------------

root@ipbx1:/etc/logrotate.d $ logrotate -vf /etc/logrotate.conf
Code:
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file asterisk
reading config info for /var/log/asterisk/full
error: asterisk:5 unknown option 'su' -- ignoring line
error: asterisk:5 unexpected text
reading config file asterisk.save
error: asterisk.save:1 duplicate log entry for /var/log/asterisk/full
error: found error in /var/log/asterisk/full , skipping
removing last 1 log configs




 

Members online

No members online now.

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top