Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 313099 - sys-process/acct should include a logrotate script
Summary: sys-process/acct should include a logrotate script
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2010-04-04 16:03 UTC by Jeremy Sermersheim
Modified: 2010-11-15 14:58 UTC (History)
2 users (show)

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


Attachments
logrotate script for sys-process/acct (acct,456 bytes, text/plain)
2010-04-04 16:03 UTC, Jeremy Sermersheim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Sermersheim 2010-04-04 16:03:09 UTC
sys-process/acct currently doesn't offer a logrotate script which can enable the /var/account/pacct file to grow quite large.  i've attached a logrotate script that i took from red hat and modified it for gentoo

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/acct start
2. /var/account/pacct file continues to grow
3. /usr/sbin/logrotate /etc/logrotate.conf doesnt manage the pacct file



Expected Results:  
the sys-process/acct ebuild should contain a useful logrotate script
Comment 1 Jeremy Sermersheim 2010-04-04 16:03:50 UTC
Created attachment 226561 [details]
logrotate script for sys-process/acct
Comment 2 Jeremy Sermersheim 2010-04-04 16:05:05 UTC
i also modified the /etc/init.d/acct script and added 'off' to the 'accton' line in the stop stanza:

stop() {
        ebegin "Stopping accounting"
        accton off
        eend $?
}
Comment 3 Jeremy Sermersheim 2010-04-04 16:07:28 UTC
another note....the ebuild should contain the /var/account/pacct file as a null file with the proper ownership/permissions otherwise logrotate will complain about the file not being present
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2010-04-28 19:21:43 UTC
(In reply to comment #2)
> i also modified the /etc/init.d/acct script and added 'off' to the 'accton'
> line in the stop stanza:
> 
> stop() {
>         ebegin "Stopping accounting"
>         accton off
>         eend $?
> }
> 

That's already fixed through bug #316517.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2010-04-28 19:33:15 UTC
I've added your suggested script in sys-process/acct-6.5.4-r1. Thanks for reporting and for the script!
Comment 6 Oleg Gawriloff 2010-11-15 12:54:18 UTC
If acct daemon is not started logrotate always fails with error: /var/account/pacct: No such file or directory. Therefore /etc/logrotate.d/acct should include 'missingok' directive.
Without missingok:
albatros2 ~ # logrotate -v /etc/logrotate.d/acct
reading config file /etc/logrotate.d/acct
reading config info for /var/account/pacct

Handling 1 logs

rotating pattern: /var/account/pacct  after 1 days (31 rotations)
empty log files are not rotated, old logs are removed
considering log /var/account/pacct
error: stat of /var/account/pacct failed: Нет такого файла или каталога

With missingok:
albatros2 ~ # logrotate -v /etc/logrotate.d/acct
reading config file /etc/logrotate.d/acct
reading config info for /var/account/pacct

Handling 1 logs

rotating pattern: /var/account/pacct  after 1 days (31 rotations)
empty log files are not rotated, old logs are removed
considering log /var/account/pacct
  log /var/account/pacct does not exist -- skipping
not running prerotate script, since no logs will be rotated
not running postrotate script, since no logs were rotated
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2010-11-15 14:58:34 UTC
(In reply to comment #6)
> If acct daemon is not started logrotate always fails with error:

RCS file: /var/cvsroot/gentoo-x86/sys-process/acct/files/acct.logrotate,v
Working file: files/acct.logrotate
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;     selected revisions: 2
description:
----------------------------
revision 1.2
date: 2010-11-11 08:52:10 +0100;  author: jer;  state: Exp;  lines: +1 -0;  commitid: 1
2924cdba0aa4567;                                                                       Add missingok by Tom Hendrikx (bug #344963).

(Portage version: 2.1.9.24/cvs/Linux i686)

Please don't hijack seemingly related bug reports.