Re: Error with logrotate.
On Tuesday 13 August 2019 13:06:23 Dan Purgert wrote:
> Gene Heskett wrote:
> > On Tuesday 13 August 2019 05:41:52 Dan Purgert wrote:
> >> Gene Heskett wrote:
> >> > On Tuesday 13 August 2019 02:24:34 deloptes wrote:
> >> > [...]
> >> >
> >> >> I am not aware of any program I've been using
> >> >> for the past 15y that would have a problem writing in /var/log
> >> >
> >> > Then tell me how fetchmail, procmail, clamav or spamd running as
> >> > me, can keep their logs in /var/log, the permissions just aren't
> >> > there after a reboot.
> >>
> >> Aren't all four of those system services; with their own system
> >> users, with their own directories in /var/log (or well, at least by
> >> default)?
> >
> > No, while they may be callable by anyone, they all become the user
> > calling them.
>
> Ah, spamd & clamav are their own users here; and I don't use the other
> two (so assumed wrongly). Thanks for clarifying.
>
> >> [...]
> >> Assuming a Debian-standard /etc/logrotate.conf; it should give one
> >> the necessary examples to set up a functioning schedule for things
> >> in their $HOME (or other places).
> >
> > O0kkaayy, splain this:
> > my entry for these logs in /etc/logrotate.d:
> >
> > /home/gene/log/fetchmail.log
> > /home/gene/log/procmail.log
> > /home/gene/log/mail.log
> > {
> > su gene mail
> > rotate 4
> > maxsize 5000000
> > weekly
> > missingok
> > notifempty
> > copytruncate
> > compress
> > delaycompress
> > postrotate
> > kill -HUP fetchmail
> > kill -HUP procmail
> > kill -HUP spamd
> > endscript
> > }
> >
> > and an ls -l of ~/log
> >
> > gene@coyote:/etc/logrotate.d$ ls -l ~/log
> > total 68804
> > -rw-r--r-- 1 gene gene 5413354 Aug 13 09:36 fetchmail.log
> > -rw------- 1 gene mail 0 Aug 12 00:08 fetchmail.log.1
> > -rw------- 1 gene mail 20 Aug 4 00:10 fetchmail.log.2.gz
> > -rw------- 1 gene mail 20 Jul 28 00:09 fetchmail.log.3.gz
> > -rw-r--r-- 1 gene gene 636567 Aug 13 09:36 mail.log
> > -rw------- 1 gene mail 0 Aug 12 00:08 mail.log.1
> > -rw------- 1 gene mail 20 Aug 4 00:10 mail.log.2.gz
> > -rw------- 1 gene mail 20 Jul 28 00:09 mail.log.3.gz
> > -rw-r--r-- 1 gene gene 64361979 Aug 13 09:36 procmail.log
> > -rw------- 1 gene mail 0 Aug 12 00:08 procmail.log.1
> > -rw------- 1 gene mail 20 Aug 4 00:10 procmail.log.2.gz
> > -rw------- 1 gene mail 20 Jul 28 00:09 procmail.log.3.g
> >
> > Which does not look like its being properly rotated to me.
> > Yet this worked (without the maxsize option I just now added) for
> > all the years on wheezy. And yes, I am a member of group mail
>
> Looks like it's trying to run correctly (June 28 -> Aug 4 being a
> week; 4th to 12th being 8 days). Although it looks like your options
> may be having problems such that the processes aren't moving the logs
> properly.
>
> Although, as I recall, multiple lines cause issues (or at least they
> did for me); you'll probably be better served with something like
> this:
>
> /home/gene/log/*.log
> {
> rotate 4
> maxsize 5000000
> weekly
> missingok
> notifempty
> copytruncate
> compress
> delaycompress
> postrotate
> /bin/kill -HUP fetchmail
> /bin/kill -HUP procmail
> /bin/kill -HUP spamd
> endscript
> }
>
> Note that:
>
> - I removed the 'su' line; as I don't see it as an option in my
> manpage
your man page might be diff, from mine:
su user group
Rotate log files set under this user and group instead of
using default user/group (usually root). user specifies the user name
used for rotation and group
specifies the group used for rotation. If the user/group
you specify here does not have sufficient privilege to make files with
the ownership you've speci‐
fied in a create instruction, it will cause an error.
> - I used the full path to kill, as I cron doesn't usually have a
fixed.
> HTH
might. Since the logfile is owned and grouped by me I changed to
su gene gene
too.
We'll check again tomorrow.
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>
Reply to: