Hi, I want my apache log files to be rotated when they're bigger then 50M and ONLY when they're bigger. But my /etc/logrotate.conf says: # rotate log files weekly weekly I added a file /etc/logrotate.d/apache: /var/log/apache2/*.log { size=20M ... } What's gonna happen? Are the files rotated even when they're smaller than 50M? Do i have to change the global options and thus all other configurations in /etc/logrotate.d? Till
* Till Wimmer <suse-e@tonarchiv.ch> [04-28-06 00:11]:
I want my apache log files to be rotated when they're bigger then 50M and ONLY when they're bigger.
But my /etc/logrotate.conf says: # rotate log files weekly weekly
I added a file /etc/logrotate.d/apache: /var/log/apache2/*.log { size=20M ... }
What's gonna happen? Are the files rotated even when they're smaller than 50M?
yes, you have size=20M My config: size=+10M
Do i have to change the global options and thus all other configurations in /etc/logrotate.d?
no, but.... (suggested, not tested) /var/log/apache2/*._log { compress dateext size=+50M notifempty missingok postrotate /etc/init.d/apache2 reload endscript } man logrotate -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
Patrick Shanahan wrote:
* Till Wimmer <suse-e@tonarchiv.ch> [04-28-06 00:11]:
I want my apache log files to be rotated when they're bigger then 50M and ONLY when they're bigger.
But my /etc/logrotate.conf says: # rotate log files weekly weekly
I added a file /etc/logrotate.d/apache: /var/log/apache2/*.log { size=20M ... }
What's gonna happen? Are the files rotated even when they're smaller than 50M?
yes, you have size=20M
My config: size=+10M
Ah yes, of course - the 20M was a typo :) I was wondering because of the "weekly" in the global logrotate.conf. So what's more crucial: The weekly or the size=50M directive... and why? The man pages don't answer this. My /etc/logrotate.de/apache looks like this: /vhosts/substring/log/*.log /vhosts/tonarchiv/log/*.log /vhosts/safoso/log/*.log { size 50M rotate 9999 dateext compress delaycompress nocreate nocopy sharedscripts postrotate apachectl graceful endscript } Thanx - Till
* Till Wimmer <suse-e@tonarchiv.ch> [04-28-06 19:44]:
I was wondering because of the "weekly" in the global logrotate.conf. So what's more crucial: The weekly or the size=50M directive... and why? The man pages don't answer this.
?? Mine does. man logrotate, search for weekly. Under 'CONFIGURATION FILE' there is a discription of 'weekly''s action.
My /etc/logrotate.de/apache looks like this:
what about /etc/logrotate.d/apache2 ^^^ ^^^
/vhosts/substring/log/*.log /vhosts/tonarchiv/log/*.log /vhosts/safoso/log/*.log { size 50M
rotate at 50M unless another condition *here* comes sooner
rotate 9999
will rotate at 9999 days even if 1M
dateext compress delaycompress nocreate nocopy sharedscripts postrotate apachectl graceful endscript }
you omitted: missingok /etc/init.d/apache2 reload ?? apachectl graceful ?? The man pages for logrotate are actually quite good, but do require some study. If you mis-type your config files, they will not do what you expect! -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Friday 2006-04-28 at 06:08 +0200, Till Wimmer wrote:
I want my apache log files to be rotated when they're bigger then 50M and ONLY when they're bigger.
But my /etc/logrotate.conf says: # rotate log files weekly weekly
I added a file /etc/logrotate.d/apache:
In my 9.3 there is already a /etc/logrotate.d/apache2, that came with the distro. Didn't you have it? It already has all the logs listed separately. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEUqZUtTMYHG2NR9URAivxAJwI1tRBuT4dqD4BoeFwpyFVOEQAsACfcoIk KnBEboPGQ1pUFqy0Rrqrljo= =powM -----END PGP SIGNATURE-----
participants (3)
-
Carlos E. R.
-
Patrick Shanahan
-
Till Wimmer