Re: [SLE] What does logrotate do?

From: Patrick Shanahan (paka_at_wahoo.no-ip.org)
Date: 09/28/04

  • Next message: Harsh Busa: "[SLE] all in one printer"
    Date: Mon, 27 Sep 2004 23:03:06 -0500
    To: suse-linux-e@suse.com
    
    

    * Paul W. Abrahams <abrahams@acm.org> [09-27-04 22:03]:
    > On Monday 27 September 2004 10:08 pm, James Knott wrote:
    >
    > > What it does, is at a schedule, create dated copies of the various
    > > log files, with the oldest file being deleted. This is to prevent
    > > the disk filling up with logs and also separating parts of the log by
    > > date, to make it easier to find info.
    >
    > So I guess it's not particularly helpful for what I'd like to do with a
    > specialized logfile: delete all entries that are more than two weeks
    > old. I could use "tail" in a short shell script to do a length-based
    > truncation, but it's not clear how to do a date-based truncation,
    > assuming every entry starts with a date. It's programmable, of course,
    > but not simple.

    Why dismiss something without looking into it? The description
    provided above is accurate but very terse. You should read the
    man/info pages before making rash decisions.

    > Is there some kind of utility around that does date-based truncation?

    Certainly, and the parameters are simple and straight forward with
    good documentation. The utility you want is *logrotate*.

    ie:

    /etc/logrotate/apache2 (partial):

    /var/log/apache2/access_log {
        compress compress the archive
        dateext rename by date
        maxage 365 oldest before rotate
        rotate 99 delete 100th file
        size=+4096k max file size before rotate
        notifempty only rotate if not empty
        missingok no error if missing
        create 644 root root permissions on archive
        postrotate do commands after rotate
         /etc/init.d/apache2 reload restart apache2
        endscript finished this script
    }

    *read* the man/info file.....

    I rotate my fetchmail logs:

    /var/log/fetchmail {
        compress
        dateext
        maxage 365
        rotate 99
        size=+1024k
        notifempty
        missingok
        copytruncate
    }

    -- 
    Patrick Shanahan                        Registered Linux User #207535
    http://wahoo.no-ip.org                        @ http://counter.li.org
    HOG # US1244711           Photo Album:  http://wahoo.no-ip.org/photos
    -- 
    Check the headers for your unsubscription address
    For additional commands send e-mail to suse-linux-e-help@suse.com
    Also check the archives at http://lists.suse.com
    Please read the FAQs: suse-linux-e-faq@suse.com
    

  • Next message: Harsh Busa: "[SLE] all in one printer"

    Relevant Pages

    • Re: SQL server backup and truncate log file
      ... Robert Klemme wrote: ... If I set recovery model SIMPLE then truncation of log files will be ... Is there any way to automate truncation of log file and ...
      (comp.databases.ms-sqlserver)
    • Re: SQL server backup and truncate log file
      ... If I set recovery model SIMPLE then truncation of log files will be ... database changes made since the last backup was taken. ... Is there any way to automate truncation of log file and ...
      (comp.databases.ms-sqlserver)
    • Re: logrotate and NULLs after rotating
      ... betelge87 wrote: ... We thought that copytruncate was able to truncate log files. ... it to close the file before you do the truncation. ...
      (comp.unix.solaris)
    • SQL Server 2000 Backup
      ... Are there any know issues with truncation of log files? ... We currently have a SQL Server databse in which we back up log files several ... Anthony ...
      (microsoft.public.sqlserver.server)
    • Re: Unable to create the log file for site
      ... I changed the schedule of moving the IISlogs to run weekly vice ... once the log files are moved in the weekly schedule. ... >> Administrators and system have FC and the Inet anonymous account has read. ...
      (microsoft.public.inetserver.iis)

    Loading