[olug] Reduce Directory Size

Vincent vincentr at cox.net
Mon May 19 17:57:22 UTC 2003


Are you using logrotate?  Logrotate (properly configured) will cycle out old data and gzip them if you want.
For compression, I would prefer to let the kernel (ext# filesystems) handle it so I don't have to manually uncompress old files to
view them.  Check out the "c" option in the chattr/ lsattr man pages.

Here's an example of how I make sshd log separately and rotate the log files with logrotate:
[user at host ~] cat /etc/logrotate.conf
# rotate log files weekly
weekly
# keep 12 weeks worth of backlogs
rotate 12
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

[user at host ~] cat /etc/logrotate.d/sshd
/var/log/sshd {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/sshd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

[user at host ~] grep LOCAL6 /etc/ssh/sshd_config:
SyslogFacility LOCAL6

[user at host ~] grep LOCAL6 /etc/syslog.conf:
local6.*;auth.*;authpriv.*                              /var/log/sshd

----- Original Message ----- 
From: "Jon H. Larsen" <relayer at omahadirect.net>
To: <olug at olug.org>
Sent: Monday, May 19, 2003 9:47 AM
Subject: [olug] Reduce Directory Size


> Howdy,
>
> I discovered this morning that my /var/log directory had grown to 18 Meg,
> mostly due to many thousands of mgetty.log.ttyS0.* entries.  I found a
> great perl script to clean out the files, but now I'm left with a rather
> large directory structure that I would like to reduce in size.
>
> Here is what the directory looks like:
>
> drwxr-xr-x    6 root     root     19300352 May 19 09:13 log
>
> Here is where I found the perl script to help clean the dir:
>
> http://rattler.cajuninc.com/pipermail/pbml/2003-February/000095.html
>
> One way I thought about was to drop to runlevel 1, make sure the
> syslog daemon isn't running, move /var/log/ to /var/oldlog, create a new
> /var/log folder, and move the proper files back from /var/oldlog and go
> back to runlevel 3.
>
> Is there another way to do this? Will running e2fsck on the filesystem
> reduce the directory size?  Is there a switch that is used?
>
> Any way to tell mgetty to stop all the logging?
>
> This box is headless, with Serial Console enabled.
>
> Jon L.
>
>
>
> -- 
>  [ Jon H. Larsen  - email: relayer at omahadirect dot net         ]
>  [ ICQ#: 10412618 - http://www.animesunday.org/jonl               ]
>  [ PGP Pubkey - http://www.animesunday.org/jonl/relayerpubkey.txt ]
>  [ OpenOffice.org - Freedom at Work - http://www.openoffice.org   ]
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>



More information about the OLUG mailing list