9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] syslog to bsd/linux systems
@ 2008-05-26 16:15 ron minnich
  2008-05-26 17:47 ` Williams, Mitch
  2008-05-26 23:41 ` Russ Cox
  0 siblings, 2 replies; 5+ messages in thread
From: ron minnich @ 2008-05-26 16:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I know this question has been addressed before but I hvae not yet
found the discussion.

I am moving 9grid.net to a new location in california, but the site is
requesting that I send all syslog output to a linux host.

Anyone recall simple solution here? It's tempting to just do it via
shell script, for fun, but if somebody's got a known good setup that
would save me some time.

thanks

ron



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] syslog to bsd/linux systems
  2008-05-26 16:15 [9fans] syslog to bsd/linux systems ron minnich
@ 2008-05-26 17:47 ` Williams, Mitch
  2008-05-27  8:41   ` Steve Simon
  2008-05-26 23:41 ` Russ Cox
  1 sibling, 1 reply; 5+ messages in thread
From: Williams, Mitch @ 2008-05-26 17:47 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs,
	Fans of the OS Plan 9 from Bell Labs

where is John when we need 'em?
-mlw
________________________________________
From: 9fans-bounces@9fans.net [9fans-bounces@9fans.net] On Behalf Of ron minnich [rminnich@gmail.com]
Sent: Monday, May 26, 2008 9:15 AM
To: Fans of the OS Plan 9 from Bell Labs
Subject: [9fans] syslog to bsd/linux systems

I know this question has been addressed before but I hvae not yet
found the discussion.

I am moving 9grid.net to a new location in california, but the site is
requesting that I send all syslog output to a linux host.

Anyone recall simple solution here? It's tempting to just do it via
shell script, for fun, but if somebody's got a known good setup that
would save me some time.

thanks

ron




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] syslog to bsd/linux systems
  2008-05-26 16:15 [9fans] syslog to bsd/linux systems ron minnich
  2008-05-26 17:47 ` Williams, Mitch
@ 2008-05-26 23:41 ` Russ Cox
  2008-05-27  4:09   ` ron minnich
  1 sibling, 1 reply; 5+ messages in thread
From: Russ Cox @ 2008-05-26 23:41 UTC (permalink / raw)
  To: 9fans

> I know this question has been addressed before but I hvae not yet
> found the discussion.
>
> I am moving 9grid.net to a new location in california, but the site is
> requesting that I send all syslog output to a linux host.
>
> Anyone recall simple solution here? It's tempting to just do it via
> shell script, for fun, but if somebody's got a known good setup that
> would save me some time.

I don't understand the problem.  Since Plan 9 doesn't
generate any syslog output, you're already sending it
all to their linux host.

I don't remember whether the code below actually works.

Russ


#include <u.h>
#include <libc.h>
#include <bio.h>

enum
{
	FSystem = 3,  // facility: system daemons
	SInfo = 6,  // severity: informational
};

void
usage(void)
{
	fprint(2, "usage: cat log-source | syslog [-p pri] [-h host] [-t tag] addr\n");
	exits("usage");
}

char *mon = "JanFebMarAprMayJunJulAugSepOctNovDec";

void
main(int argc, char **argv)
{
	int pri, fd, n;
	char *host;
	Biobuf b;
	char *p, msg[1000], *tag;
	Tm *tm;

	pri = FSystem*8 + SInfo;
	host = sysname();
	tag = "zzz";
	ARGBEGIN{
	case 'p':
		pri = atoi(EARGF(usage()));
		break;
	case 'h':
		host = EARGF(usage());
		break;
	case 't':
		tag = EARGF(usage());
		break;
	default:
		usage();
	}ARGEND

	if(argc != 1)
		usage();
	fd = dial(netmkaddr(argv[0], "udp", "syslog"), nil, nil, nil);
	if(fd < 0)
		sysfatal("dial %s: %r", argv[0]);

	Binit(&b, 0, OREAD);
	while((p = Brdstr(&b, '\n', 1)) != nil){
		tm = localtime(time(0));
		n = snprint(msg, sizeof msg,
			"<%d>%.3s %02d %02d:%02d:%02d %s %s: %s",
			pri, mon+tm->mon*3, tm->mday, tm->hour, tm->min, tm->sec,
			host, tag, p);
		free(p);
		write(2, msg, n);
		write(fd, msg, n);
	}
	exits(0);
}



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] syslog to bsd/linux systems
  2008-05-26 23:41 ` Russ Cox
@ 2008-05-27  4:09   ` ron minnich
  0 siblings, 0 replies; 5+ messages in thread
From: ron minnich @ 2008-05-27  4:09 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Mon, May 26, 2008 at 4:41 PM, Russ Cox <rsc@swtch.com> wrote:

> I don't understand the problem.  Since Plan 9 doesn't
> generate any syslog output, you're already sending it
> all to their linux host.
>

or at least as much as I'd like to :-)

thanks

ron



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] syslog to bsd/linux systems
  2008-05-26 17:47 ` Williams, Mitch
@ 2008-05-27  8:41   ` Steve Simon
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Simon @ 2008-05-27  8:41 UTC (permalink / raw)
  To: 9fans

I have a syslog daemon (message collector) if this is what you need.
/n/sources/contrib/steve/syslogd.c - Nigel Rolls's code which I hacked a little.
I use this to pick up the chatter from my router at home (which I never look at).

-Steve



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-27  8:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-26 16:15 [9fans] syslog to bsd/linux systems ron minnich
2008-05-26 17:47 ` Williams, Mitch
2008-05-27  8:41   ` Steve Simon
2008-05-26 23:41 ` Russ Cox
2008-05-27  4:09   ` ron minnich

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).