From owner-freebsd-questions@FreeBSD.ORG Fri Nov 30 09:19:13 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE2684E4 for ; Fri, 30 Nov 2012 09:19:13 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 4461B8FC0C for ; Fri, 30 Nov 2012 09:19:12 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id qAU9KTcF043099; Fri, 30 Nov 2012 03:20:29 -0600 (CST) Date: Fri, 30 Nov 2012 03:20:29 -0600 (CST) From: Robert Bonomi Message-Id: <201211300920.qAU9KTcF043099@mail.r-bonomi.com> To: pschmehl_lists@tx.rr.com Subject: Re: Unexepected results when piping syslog to a fifo In-Reply-To: Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 09:19:13 -0000 > Date: Thu, 29 Nov 2012 22:21:30 -0600 > From: Paul Schmehl > Subject: Re: Unexepected results when piping syslog to a fifo > > Now I'm even more confused. According to man (5) syslog.conf, a pipe > should redirect its output to /dev/null. > > " A vertical bar (``|''), followed by a command to pipe the > selected > messages to. The command is passed to sh(1) for evaluation, so > usual > shell metacharacters or input/output redirection can occur. (Note > however that redirecting stdio(3) buffered output from the invoked > command can cause additional delays, or even lost output data in > case > a logging subprocess exited with a signal.) The command itself > runs > with stdout and stderr redirected to /dev/null." > > And yet this: > > *.* |cat > /var/run/program/program.fifo results in the log data going both > to the fifo and to /var/log/messages. I really don't want to fill up the > messages log with this stuff. Any suggestions? to clear up the confusion: 1) syslogd creates an environment where stdout/stderr are set to /dev/null, invokes sh in that environment, passing it the command string for evaluation/execution. If the command string does *not* redirect stdout/stderr, they are /dev/null.*IF* redirected in he command string, things go where redirected. 2) syslogd writes messages to _every_ destination where the selection criteria match. To accomplish what you want you'll need something like: +remotehost *.* |cat >fifo -remotehost {console criteria} /dev/console {'messages' criteria} /var/log/messages {{ etc., etc.}} [ you may need "+* on it's own line just before "-remotehost"