Bug #408

sysklogd rotate script is broken

Added by Mika Havela over 1 year ago. Updated about 1 year ago.

Status:Closed Start date:08/18/2010
Priority:High Due date:
Assignee:Nathan Angelacos % Done:

100%

Category:Aports
Target version:Alpine 1.10.7

Description

When /etc/syslog.conf has lines that starts with space or tab (see below example) then the logrotate script gets confused.
In this example "/var/log/debug" and "/var/log/messages" will not be rotated as expected.

*.=debug;\
     auth,authpriv.none;\
     news.none;mail.none   -/var/log/debug
*.=info;*.=notice;*.=warn;\
     auth,authpriv.none;\
     cron,daemon.none;\
     mail,news.none        -/var/log/messages

sysklogd.diff - suggestion on how to solve the issue (277 Bytes) Mika Havela, 08/18/2010 12:44 pm

Associated revisions

Revision 6c890d6e
Added by Natanael Copa over 1 year ago

main/sysklogd: fix logrotation script

the syslogd_listfiles didnt handle the --auth option properly.
We fix this and make it slightly more readable with -e

ref #408

Revision 24dfddb1
Added by Natanael Copa over 1 year ago

main/sysklogd: fix logrotation script

the syslogd_listfiles didnt handle the --auth option properly.
We fix this and make it slightly more readable with -e

ref #408
(cherry picked from commit 6c890d6e6624ff6debcfb070d1d7fa88db0bc4ad)

Revision 1a27133d
Added by Natanael Copa about 1 year ago

main/sysklogd: fix log rotating

ref #408

Revision 12a6e9a8
Added by Natanael Copa about 1 year ago

main/sysklogd: fix log rotating

ref #408
(cherry picked from commit 1a27133d79e1de4818ccc4323bb7223680e2725c)

History

Updated by Mika Havela over 1 year ago

Please see attached diff.
This seems to solve the problem.

Updated by Natanael Copa over 1 year ago

Mika Havela wrote:

Please see attached diff.
This seems to solve the problem.

Wouldnt that create problem if there were spaces instead of tabs in config?

Updated by Mika Havela over 1 year ago

Natanael Copa wrote:

Mika Havela wrote:

Please see attached diff.
This seems to solve the problem.

Wouldnt that create problem if there were spaces instead of tabs in config?

I modified my config using both tabs and whitespaces just to make sure, and the diff worked for both tab/whitespace.

(I'm not a sed expert, but I'm a bit surprised the \t worked for the whitespaces too - but still it did.)

Updated by Natanael Copa over 1 year ago

  • Assignee changed from Natanael Copa to Nathan Angelacos

I don't think that is the correct fix. The syslogd_listfiles seems to be strange (specially the --auth part)

Looking at the debian's syslogd-listfiles, this is how i think it is supposed to work:

syslogd-listfiles   # give a list of files for daily rotation
/var/log/syslog
/var/log/mail.log
/var/log/mail.info
syslogd-listfiles --auth # only list files that may contain sensitive info
                         # used for adjusting file permissions after log rotate
/var/log/auth.log
syslogd-listfiles --weekly # give a list of files to rotate every week
/var/log/mail.warn
/var/log/uucp.log
/var/log/user.log
/var/log/daemon.log
/var/log/messages
/var/log/debug
/var/log/auth.log
/var/log/mail.err
/var/log/kern.log
/var/log/lpr.log

However, our script runs only a daily rotate job, and it seems to expect that --auth will only list protected files and without --auth all except protected.

for LOG in $( syslogd_listfiles ); do
        [ -f $LOG ] && savelog -g adm -m 640 -u root -c 7 $LOG
done

for LOG in $(syslogd_listfiles --auth); do
        [ -f $LOG ] && savelog -g adm -m 640 -u root -c 7 $LOG
done

So my question is: what do we want this thingy to do? Rotate everythign daily, but set different permissions for sensitive files (auth)? Do what debian does, rotate most files weekly but some daily?

Need to know how its supposed to work before we can try fix anything.

Updated by Natanael Copa over 1 year ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 90

I fixed this with sysklogd-1.5-r7. the --auth works as a toggle, without --auth it will list all files except those with auth facility, with --auth its the opposite.

Otherwise we rotate the file twice.

Please test that this works in edge.

More.. I think we might want move savelog and syslogd-listfiles to separate files and have a cronjob that rotates those weekly, and for the daily job we just check so file does not pass certain size before we rotate.

Thats another story though...

Updated by Natanael Copa about 1 year ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF