9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@coraid.com>
To: 9fans@9fans.net
Subject: Re: [9fans] How to get the diagnostics of fs(3)
Date: Wed, 15 Oct 2008 08:42:07 -0400	[thread overview]
Message-ID: <7807852439120719b87d05dc1e00b529@coraid.com> (raw)
In-Reply-To: <20081015082813.GD1296@hermes.my.domain>

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

we have three different console servers at coraid.
so i've changed how consoles and console logging
works.  maybe this will be useful to other people.

here are the changes that make this work
1. instead of consoledb use /lib/ndb/consoledb.$sysname.
and have a general test for this new file in cpurc.
	if(test -f /lib/ndb/consoledb.$sysname){
		aux/consolefs -c /lib/ndb/consoledb.$sysname
		startclog
	}
2. startclog (attached) uses a new consoledb tuple
clog=$sysname, e.g. from /lib/ndb/consoledb.baron
	console=ila dev=/dev/eia5
		gid=sys
		clog=baron

(the -r flag is part of a very sneaky trick involving booting
from a skeleton kfs and binding large bits of the namespace
back via aan so that the console logger can survive loosing
its connection to the fs without having console logging
end up someplace other than the man fs.  the way to start
it is startclog; startclog -r.  this setup survived a switch gone
wild a few weeks ago.)

3. add the directory /sys/log/clog & create the console
files you wish.

- erik

[-- Attachment #2: startclog --]
[-- Type: text/plain, Size: 663 bytes --]

#!/bin/rc
rfork e
rflag=0
if(~ $1 -r)
	rflag=1
cd /mnt/consoles
for(i in *){
	x = `{ndb/query -f/lib/ndb/consoledb.$sysname console $i clog}
	if(~ $rflag 0 && ~ $x $sysname){
		log=/sys/log/clog/$i
		if(~ $rflag 1){
			mkdir -p /tmp/clog
			log=/tmp/clog/$i
		}
		while(~ 1 1){
			echo aux/clog $log /mnt/consoles/$i
			aux/clog /mnt/consoles/$i $log && echo clog exits $status
			sleep 10;
		}
	}&
}
fn rotate{
	rm /tmp/oclog/*
	cp /tmp/clog/* /tmp/oclog
	rm /tmp/clog/*
}
if(~ $rflag 1){
	mkdir -p /tmp/oclog /tmp/clog
	while(~ 1 1){
		sleep 600
		s=`{du -a /tmp/clog| sed 's/[ 	].*//g'}
		if(test $s -gt 10000)
			rotate
	}
}&

      parent reply	other threads:[~2008-10-15 12:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15  8:28 Christian Kellermann
2008-10-15  8:39 ` Fco. J. Ballesteros
2008-10-15  8:47   ` Christian Kellermann
2008-10-15  9:13     ` Fco. J. Ballesteros
2008-10-15 15:48     ` ron minnich
2008-10-15 15:54       ` andrey mirtchovski
2008-10-15 16:19         ` erik quanstrom
2008-10-15 18:37           ` Christian Kellermann
2008-10-16  0:57             ` erik quanstrom
2008-10-16  7:38               ` Christian Kellermann
2008-10-15 12:42 ` erik quanstrom [this message]

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=7807852439120719b87d05dc1e00b529@coraid.com \
    --to=quanstro@coraid.com \
    --cc=9fans@9fans.net \
    /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).