supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Alex Efros <powerman@powerman.asdfGroup.com>
Subject: limit svlogd log dir size
Date: Mon, 13 Feb 2006 20:16:12 +0200	[thread overview]
Message-ID: <20060213181612.GD6585@home.power> (raw)

Hi!

Is there exists way to limit size of svlogd's log directory, to guarantee
it will not become too big and result in 'disk full' error?

Usually svlogd rotate log files, but in some cases it will not, and amount
of log files become much bigger than set in 'n' option in ./config
(see example how this can happens below).

I see only way to fix this issue - set special cron script which will
remove unwanted log files, but that script probably will not be simple
because which files are "unwanted" in each directory depends in ./config
in that directory, so script should parse ./config, multiple values
on "n" and "s" options (substituting default values if options not exists)
to find total size allowed for '@*' + 'current' files and then remove
oldest files until size of left files will be less than calculated sum.
Sounds more like work for svlogd when it starting, not for cron script...


powerman@home ~/tmp $ mkdir log ; echo -e "n2\ns1" >log/config
powerman@home ~/tmp $ for i in $(seq 1 20); do perl -e '$|=1; print "x\n"; sleep 1; kill -9, $$' | svlogd log/; done
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
Killed
powerman@home ~/tmp $ ls -al log/
total 91
drwxr-xr-x   2 powerman users 1080 Feb 13 20:03 .
drwxr-xr-x  16 powerman users 2128 Feb 13 20:02 ..
-rw-r--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9db047d0a4c.u
-rwxr--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9db04c9cea4.s
-rw-r--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9dc04f87fc4.u
-rwxr--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9dc05450984.s
-rw-r--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9dd0573e59c.u
-rwxr--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9dd05c086cc.s
-rw-r--r--   1 powerman users    1 Feb 13 20:02 @4000000043f0c9de05f07c24.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9de063d1584.s
-rw-r--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9df06688a84.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9df06b53b54.s
-rw-r--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e006e455ec.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e007306a7c.s
-rw-r--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e1075ffa44.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e107abdc0c.s
-rw-r--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e207daeed4.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e2082699ec.s
-rw-r--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e30855d3c4.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e308a2693c.s
-rw-r--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e408e9651c.u
-rwxr--r--   1 powerman users    1 Feb 13 20:03 @4000000043f0c9e4091b61fc.s
-rw-r--r--   1 powerman users    6 Feb 13 20:02 config
-rw-r--r--   1 powerman users    1 Feb 13 20:03 current
-rw-------   1 powerman users    0 Feb 13 20:02 lock
powerman@home ~/tmp $ cat log/config 
n2
s1

:-(

-- 
			WBR, Alex.


             reply	other threads:[~2006-02-13 18:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-13 18:16 Alex Efros [this message]
2006-02-14  8:49 ` Gerrit Pape
2006-02-14  9:15   ` Alex Efros
2006-02-14 10:25     ` Gerrit Pape

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060213181612.GD6585@home.power \
    --to=powerman@powerman.asdfgroup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).