Mailinglist Archive: opensuse (2359 mails)

< Previous Next >
Re: [opensuse] /var/log/zypp-refresh.log Size on 11.0? ( 275 Megabytes -- WTF? )
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Sun, 22 Mar 2009 03:03:27 -0500
  • Message-id: <49C5F0CF.5@xxxxxxxxxxxxxxxxxx>
Carlos E. R. wrote:


On Saturday, 2009-03-21 at 20:24 -0500, David C. Rankin wrote:

My /var/log/zypp-refresh.log had grown alarmingly big:

-rw-r----- 1 root root 275072020 2009-03-20 22:51
zypp-refresh.log

Some got a log on the several gigabytes range, filling the entire
partition. To repair the system the file was deleted, so that it is
unknown why it is lo large. It was commented here not too long ago.

Perhaps you could examine that log and determine why it is so large,
then open a bugerport on bugzilla - sending the log to them is probably
not practical.

Perhaps try compressing with lzma - logs compress a lot with that one.
Maybe it gets down to a practical size.

-- Cheers,
Carlos E. R.

Here are the alarming stats. Roughly 24 hours ago, I cleaned the
zypp-refresh.log by archiving the old stuff and starting a new log:

bzip2 zypp-refresh.log && touch zypp-refresh.log

Since last night, the log has grown to over 25 Meg comprised of 18,388
lines:

-rw-r----- 1 root root 9491674 2009-03-20 22:51
zypp-refresh-20090321.log.bz2
-rw-r----- 1 root root 2547826 2009-03-21 22:50 zypp-refresh.log


[00:27 alchemy:/var/log] # wc -l zypp-refresh.log
18388 zypp-refresh.log

Is there some way to turn down the log level for zypper refresh?

As another test, I reset the zypp-refresh.log and tested with a single
zypper
ref to see how much was generated:

[00:33 alchemy:/var/log] # bzip2 zypp-refresh.log && mv zypp-refresh.log.bz2
zypp-refresh-$(date '+%Y%m%d.%H%M').log.bz2 && touch zypp-refresh.log && zypper
ref
Repository 'Updates for 11.0' is up to date.

<snip all repos already up to date>

All repositories have been refreshed.

[00:37 alchemy:/var/log] # l zypp-re*
-rw-r----- 1 root root 9491674 2009-03-20 22:51 zypp-refresh-20090321.log.bz2
-rw-r----- 1 root root 92172 2009-03-21 22:50
zypp-refresh-20090322.0036.log.bz2
-rw-r--r-- 1 root root 0 2009-03-22 00:36 zypp-refresh.log

Surprisingly, no log information was generated. I don't know whether
this is
because the repo data was already up to date (my guess) or whether using
'zypper ref' doesn't write to the zypp-refresh.log. In any case, log file
growth of 25M/day isn't something that is acceptable. I can imagine the
surprise of you guys finding 16G log files.

I guess the solution until this is fixed is to write a script to call
by cron
each day that will compress the current file if it is over 10M and move it to
somewhere convenient.

I went ahead a created a script to check log file size that you can add
to the
root cron tab to run once daily. I called the script cklogsize, and a cron
entry to run it at 10 minutes after 4 am each day would be:

10 4 * * * /home/david/linux/scripts/log/cklogsize zypp-refresh.log

The script and explanation follows. To make sure you don't have any
line wrap
problems, you can also download a copy here:

http://www.3111skyline.com/download/linux/scripts/cklogsize

#!/bin/bash --norc
##
## Title: Check Log Size
## Name: cklogsize
## Usage: cklogsize logfilename [maxsize [newzipfiledir]]
## Version: 0.0.1
## Date: 03/22/2009, 01:02:14 AM
## Author: David C. Rankin, J.D.,P.E
## Summary: cklogsize will check the size of a log file supplied as a
command line
## argument against the default size of 10M (or the size supplied
as the
second argument
## on the command line in bytes) and if the log file size exceeds
the maximum,
compress
## the log files with bzip2 to the original log file directory (or
new
directory if
## provided as the third argument on the command line) and create
a new empty
log file.
## It is intended to be called by cron.
##
## Run as: log file owner or root
## Requires: bzip2
##
##
#

[[ -z $1 ]] && { echo -e "\n\tUsage:\t'${0##*/} logfilename [maxsize
[zipfiledir]]'\
, exiting...\n"; exit 1; }
[[ ! -r $1 ]] && { echo -e "\n\tFile: '${1}' not readable, check your
filename.\n"; exit 1; }

LOGFILE=$1
MAXSIZE=${2:-10000000}
CURRENTDIR=$(pwd)
NEWDIR=${3:-${1%/*}}
[[ $NEWDIR == $LOGFILE ]] && NEWDIR=$CURRENTDIR

declare -a FSIZESTR

FSIZESTR=( $(ls -l ${LOGFILE}) )

if [[ ${FSIZESTR[4]} -gt $MAXSIZE ]]; then
bzip2 $LOGFILE
if [[ ! -d $NEWDIR ]]; then
if ! mkdir $NEWDIR; then
echo "Unable to create directory '$NEWDIR', check that
your have permission."
exit 1
fi
fi
[[ $NEWDIR != $CURRENTDIR ]] && mv $LOGFILE.bz2 $NEWDIR
touch $LOGFILE
fi

exit 0


--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >