Logrotate.service failed error: asterisk:36

Hello, i have problem, please help whats wrong

When i Starting service logrotate.service

logrotate[9251]: error: asterisk:36 lines must begin with a keyword or a filename (possibly in double quotes)
logrotate[9251]: error: found error in file asterisk, skipping

file /etc/logrotate.d/asterisk

/var/log/asterisk/queue_log {
        daily
        missingok
        rotate 30
        notifempty
        sharedscripts
        create 0640 asterisk asterisk
        su asterisk asterisk
        postrotate
                /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
        endscript
}

/var/spool/mail/asterisk {
        daily
        missingok
        rotate 7
        notifempty
        sharedscripts
        create 0660 asterisk mail
        su asterisk mail 
}

/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
        su asterisk asterisk
        postrotate
                /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
        endscript
}
-e #This comment is to fix rpm file replacing

-e is not a filename nor a keyword

how to fix it ? i dont config any logrotate files after install freepbx… its original configs…

delete that line

does it break something ?
Why this line exists by default ?

It will break it if is there, can’t say, maybe you are special :wink: ?

I’m having the same issue here… Original FPBX logrotate config files…

What version of FreePBX are y’all using @UnknownDef @dotcom ?

Looking now at recently updated v16 and v17 but not seeing the issue in /etc/logrotate.d/asterisk …

I’m running FreePBX version 17.0.19.16.

How should the end of the file look like? Like this (keeping the comment):

#This comment is to fix rpm file replacing
#Config file built on Fri Sep 6 12:43:57 UTC 2024

Or like dicko suggested (removing the line):

#Config file built on Fri Sep 6 12:43:57 UTC 2024

Not sure if it makes any difference :)…

Number/hash/tic-tac-toe sign at the beginning of the line is usually a comment, which is much better than a hyphen.

Can’t speak for @dicko, but what it looks like is that your original copy/pasta included a “-e” before the “#This comment…”, maybe that was a typo ?

Be careful @penguinpbx , although # is almost universally recognized as the bwginning of a comment, Asterisk is an exception where it confusingly should be interpretted as an ‘inclusion path’ and the less obvious semicolon used for comments, of course this does not apply to logrotate configurations as can be confirmed with man logrotate

I believe that the original artifact of the

-e #This comment is to fix rpm file replacing

is a leftover bit of an badly formed install script for FreePBX 17 from when when Sangoma only swung RedHat , it is apparently not there anymore :wink:

Agreed, yes, thanks @dicko, when it comes to Asterisk configuration files, be wary of # – see for example the #include in FreePBX’s extensions.conf file:

Again, please don’t conflate FreePBX with Asterisk, all parts of Asterisk including Comedian Mail follow the comment comments rubric. You merely post a snippet of how FreePBX is compliant.

There should be no trace of the word “rpm” anywhere in Debian based FreePBX 17 apart from a README or such. That it existed for the OP is a clue ( to me at least) that someone blotted their copy-book a while ago in either the install script or the deeper module code it installs.

# as a directive marker comes from the C programming language and earlier. I know it is used a comment marker in shell scripts, but I’d have to check the convention for other languages. I don’t think ; is very common, as anything other than a statement delimiter, outside the Asterisk world.

Check PHP which with shell scripts is 99%+ of FreePBX.

As to # in c. well I have occasionally seen it used but most of us prefer // as it is much easier to change to /*and back for blocks, mysql inherits that behavior

# in C is used for pre-processor directives: conditional compilation and file inclusion, etc., not for comments. // to newline and /* … */ are used for comments.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.