Re: Error with logrotate.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
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
- I used the full path to kill, as I cron doesn't usually have a $PATH
set
HTH
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEBcqaUD8uEzVNxUrujhHd8xJ5ooEFAl1S7g4ACgkQjhHd8xJ5
ooFvJgf+O43AC0aYx6aVrWjvcpGhcNQr3elp42UscofoS2I4Ctiy0cRvM2e509cT
NP/uLrt5cnu6QKnUun0LWOW/tsZXxEoPvOzIRM3JGybV5/iloCF00vYbHMIht4wh
H6C8TvTmblpCsUMKns+YCfRIwykj1+jpRjEIVWsbny/ZbVHK19bGqUp8PK2lZHT9
LQ7YLt5cw4jgS9NBOOamaKn9wQwStZrN7YHUgVyxixVbJ/MarsYzZ3QvrElSPgEy
9Wy/witCKIdd2vAxhtWMxpmrL6RwQw6VJ4vokhyZuA7KjJrYqK1HGOVOHd0pGm9r
i4ApD6WAKsgooqD0OPgIfEvLk7mJnA==
=GlKw
-----END PGP SIGNATURE-----
--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281
Reply to: