Koozali.org: home of the SME Server

Question about logrotate errors

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Question about logrotate errors
« on: September 20, 2023, 06:53:34 PM »
Since restoring to our primary server I've been getting error messages from Anacron by email and I'm not sure what I need to do with them. The email is as follows:
Code: [Select]

/etc/cron.daily/logrotate:

error: modDeflate:1 duplicate log entry for /var/log/httpd/deflate_log
error: found error in file modDeflate, skipping
error: skipping "/var/log/sendmail/*.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.

For the modDeflate errors do I need to remove and reinstall the mod_deflate contribution or is there something else that I need to do? The config for modDeflate shows only level=9 and status=enabled if that helps.

I checked the user and group for /var/log/sendmail and found that it is set to apache www, what should it actually be set for? The directory contains nothing anyway but I would like to get rid of the error.

Offline ReetP

  • *
  • 3,740
  • +5/-0
Re: Question about logrotate errors
« Reply #1 on: September 20, 2023, 07:17:59 PM »
Quote
error: modDeflate:1 duplicate log entry for /var/log/httpd/deflate_log
error: found error in file modDeflate, skipping

Please read the wiki, and the bugs.

That will answer your first question.

https://wiki.koozali.org/Mod_Deflate

https://bugs.koozali.org//show_bug.cgi?id=8901

Quote
error: skipping "/var/log/sendmail/*.log"

Why have you got a sendmail directory? How did it get there as that isn't on a normal Koozali SME?
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Re: Question about logrotate errors
« Reply #2 on: September 20, 2023, 08:02:48 PM »
Why have you got a sendmail directory? How did it get there as that isn't on a normal Koozali SME?

I assume it got installed with the sendmail-wrapper contribution. Either that or it got migrated from a previous version of SME Server since we've been using SME since version 6 or 7. Since it is empty I assume it isn't needed and can be safely deleted.

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Re: Question about logrotate errors
« Reply #3 on: September 21, 2023, 06:57:21 PM »
Please read the wiki, and the bugs.

That will answer your first question.

https://wiki.koozali.org/Mod_Deflate

https://bugs.koozali.org//show_bug.cgi?id=8901


The wiki entry showed me that the config settings for mod_deflate were correct which was good to know.

Based on the bug report you pointed me to I created a custom template for /etc/logrotate.d/modDeflate and entered the following from the 07-14-2019 post modified based on the /etc/logrotate.d/httpd template due to errors I got when I tried to expand the custom template:
Code: [Select]
/var/log/httpd/deflate_log \{
  missingok
  daily
  notifempty
  rotate 10
  compress
  copytruncate
\}


This morning I got a new set of errors from the Anacron job for logrotate:
Code: [Select]
/etc/cron.daily/logrotate:

error: modDeflate:11 duplicate log entry for /var/log/httpd/deflate_log
error: modDeflate:11 lines must begin with a keyword or a filename (possibly in double quotes)
error: modDeflate:18, unexpected text after }
error: found error in file modDeflate, skipping
I'm guessing the third error message is because I have a newline character after the } which the file apparently doesn't like. All in all adding the custom template just seems to have made things worse so I think I will get rid of it. Any other suggestions? I'll add to the bug report with what I have experienced so far so someone more knowledgeable can check into the problem.

Offline Jean-Philippe Pialasse

  • *
  • 2,765
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Question about logrotate errors
« Reply #4 on: September 21, 2023, 08:33:52 PM »
as i have answere in the bug just try to remove its output by creating a blank custom template and check that it is actually totated as expected by the core rule for http. 
if yes the. the fix is to remove this rule from the contrib

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Re: Question about logrotate errors
« Reply #5 on: September 22, 2023, 01:06:53 AM »
as i have answere in the bug just try to remove its output by creating a blank custom template and check that it is actually totated as expected by the core rule for http. 
if yes the. the fix is to remove this rule from the contrib
As you suggested I created and empty template-custom folder for /etc/logrotate.d/modDeflate and tried to expand-template. When I did I got an error that no templates were found so I added a zero length file to the folder so that the template would expand. The resulting expanded modDeflate file in /etc/logrotate.d ended up looking like this:
Code: [Select]
#------------------------------------------------------------
#        !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------

I'll let you know tomorrow what if anything the Anacron job complains about this time.

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Re: Question about logrotate errors
« Reply #6 on: September 22, 2023, 06:01:40 PM »
I'll let you know tomorrow what if anything the Anacron job complains about this time.
I had no email from Anacron complaining about anything this morning so apparently the blank template for /etc/logrotate.d/modDeflate did the trick. Thanks for the help.

Offline Jean-Philippe Pialasse

  • *
  • 2,765
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Question about logrotate errors
« Reply #7 on: September 22, 2023, 07:00:36 PM »
was the log rotated ?

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Re: Question about logrotate errors
« Reply #8 on: September 22, 2023, 07:41:14 PM »
was the log rotated ?
I would assume so. I was getting an email every morning for the logrotate error and did not this morning so I would assume it is a daily job. How would I tell if a log file was rotated or not? When I view the log file for httpd/deflate_log it is really long but I don't see anything in the log that looks like a date so I have no idea what the beginning and ending date of the information contained in the log is. The two entries for deflate in the log file pull down menu are httpd/deflate_log and httpd/deflate_log-20230917. Of the other httpd logs there is only one that shows any additional dates other than 20230917 and that is the httpd/access_log which also has 20230920 and 20230922 as well as the 20230917. Since we just got our site up and running on our main server again on September 16 after replacing the hard drives and reinstalling SME and the contributions we use I'm not surprised by not seeing older log files. I wouldn't expect the backup and restore process to include log files.

Offline Jean-Philippe Pialasse

  • *
  • 2,765
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Question about logrotate errors
« Reply #9 on: September 23, 2023, 05:24:47 AM »
you made the change  after sept 17 so I would appreciate if you can check for a few days and report if you see the current log growing or being rotated.

one wise man says never AssUme…

Offline wdepot

  • ***
  • 89
  • +0/-0
    • http://westerndepot.com
Re: Question about logrotate errors
« Reply #10 on: September 26, 2023, 10:37:49 PM »
you made the change  after sept 17 so I would appreciate if you can check for a few days and report if you see the current log growing or being rotated.

one wise man says never AssUme…
I just checked the log files again today. I still haven't had any logrotate error emails since adding the blank template for modDeflate and the httpd/deflate_log now shows additional entries for 20230917, 20230923 and 20230924 so it is pretty obvious now that the deflate_log is being rotated as normal.

I wouldn't know why an empty template file for modDeflate would solve the issue with logrotate errors but it obviously did somehow.

Offline Jean-Philippe Pialasse

  • *
  • 2,765
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Question about logrotate errors
« Reply #11 on: September 26, 2023, 11:46:18 PM »
because there are two entries to rotate it.  one from core, taking care of all log files in this folder.
one from the contrib.  adding the template hide this last one.  the real fix is to remove it from  the contrib.