Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 324729 - sys-apps/portage should support logrotate
Summary: sys-apps/portage should support logrotate
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-19 19:31 UTC by DEMAINE Benoît-Pierre, aka DoubleHP
Modified: 2011-08-10 09:11 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DEMAINE Benoît-Pierre, aka DoubleHP 2010-06-19 19:31:36 UTC
ATM using sys-apps/portage-2.2_rc67

I installed my box on jan 11th:

uranus logrotate.d # ls -l /var/log/portage/ | wc
   2133   19190  208504
uranus logrotate.d # du -lsh /var/log/portage/
665M    /var/log/portage/
uranus logrotate.d #

I think that logrotate should (on weekly basis) compress log files; I don't think it's possible to reduce their number; but compressing them should be easy. For people and tools who need to search in there, we can use zgrep. Keeping files seperate and names intact (or maybe just adding a .gz extension) should not affect the rest of the process.

Compression should be performed only if files are:
- not compressed yet (not ending with .gz)
- older than 7d
find can do this easily.

Maybe portage ebuild could be sensible to logrotate flag ?

***

Compleetely different approach: add a compress "feature" (to be added to the FEATURE line of make.conf), so that logs are compressed just after emerge compleeted.

Not sure if people would prefer all logs to have the same "profile", or, to have recent logs in raw text human readable easily ... and I hope no tool (like genlop) need to analise them deeply ...
Comment 1 Gef 2010-06-20 10:32:01 UTC
DUPLICATE of bug #324191 ?
Comment 2 DEMAINE Benoît-Pierre, aka DoubleHP 2010-06-20 12:34:25 UTC
No. bug #324191 is a proposed solution only for my second proposition. If various scripts (genlop for example, and maybe other ones) need (at least for now) logs to be raw text (but maybe those tools can be patched in order to support ompressed logs), maybe logrotate is a better place to do it.

So, that bug will be the solution only if it is easier than logrotate, and, possible any way. I don't know portage tools well enough to decide.

So, conditionnaly, maybe yes.
Comment 3 DEMAINE Benoît-Pierre, aka DoubleHP 2010-09-15 16:25:22 UTC
As bug #324191 been fixed, i don't think any one will ever bother with cron or logrotate. I would personaly prefer something like (untested):

find /var/log/portage/ -maxdepth 1 -type f -mtime +8 -exec gzip {} \;

over the portage FEATURE; but i don't think any one will take time to update the portage ebuild:
- make portage sensible to logrotate
- if yes, add the following untested script, as /etc/logrotate.d/portage

# Portage logrotate script for Gentoo Linux
# rotate only logs that are older than 8d, to not force people who have bugs have to extract logs
#
/var/log/portage/*log {
  weekly
  nodateext
  missingok
  compress
  noolddir
  endscript
}

It will rename foobar.log into foobar.log.0.gz ... don't know how to not get the .0 part ...
Comment 4 Zac Medico gentoo-dev 2010-09-15 17:10:54 UTC
(In reply to comment #3)
> As bug #324191 been fixed, i don't think any one will ever bother with cron or
> logrotate. I would personaly prefer something like (untested):
> 
> find /var/log/portage/ -maxdepth 1 -type f -mtime +8 -exec gzip {} \;
> 
> over the portage FEATURE;

What reasons do you have to prefer that over FEATURES=compress-build-logs?
Comment 5 DEMAINE Benoît-Pierre, aka DoubleHP 2010-09-15 17:18:44 UTC
Both aproaches (logrotate, and find in cron):
- keep compression independant of portage
- delay compression, so that, if an emerge fails, you don't need to zcat; for example, to paste an error on IRC, you can keep using the usual "wgetpaste logile" ... and it's easier to debug and search.

In short, i want to keep fresh logs as raw text, uncompressed.

3rd aspect: it's not portage work to compress logs. ALL other "daemons" write logs in raw text; with FEATURES=compress-build-logs Portage becomes the first application to write raw-data=non-ASCII things in /var/log ever. It's logrotate job to "take old logs, and either remove them, or compress".

+ : the logrotate aproach will let people who want to delete old logs ... remove old logs. Nobody needs to keep build logs for life time. So, if your /etc/logrotate.conf policy is to remove logs after 4 weeks ... and all your applications work fine, really, you don't need to keep logs.

You need logs only for apps that don't work; and also for people who do dev and debug; dev and debug people will do like me:
rotate 4000
Comment 6 DEMAINE Benoît-Pierre, aka DoubleHP 2010-09-27 23:45:40 UTC
My final /etc/logrotate.d/portage

# Portage logrotate script for Gentoo Linux
# rotate only logs that are older than 8d, to not force people who have bugs have to extract logs
#
/var/log/portage/*log {
  weekly
  nodateext
  missingok
  compress
  noolddir
  notifempty
  nocreate
}