The original query:
I have a couple programs which log to the console ... and I don't want
them logging to the console.
I'll start with fping v2.2b1. Great app. Logs to the console ... doesn't
log to syslog.
Is there a generic way to reverse this behavior, e.g. tell it to log to
syslog but not to the console?
--------------------------------------------------------------------------
There are various solutions, including modding fping to redirect STDERR to
syslog. Thanks to Peter L. Buschman for shell script wrappers, attached
below.
Peter L. Buschman <plb@concentric.net>
Karl Vogel <vogelke@c17mis.region2.wpafb.af.mil>
Dave Wreski <dave@sam.nic.com>
James R Grinter <jrg@blodwen.demon.co.uk>
This redirects STDOUT to syslog.
#!/bin/sh
##------------------------------------------------------------------------------
## fpw - A wrapper for fping to support syslogging of responses.
##
## Peter L. Buschman <plb@concentric.net>
## 07/27/1998
##------------------------------------------------------------------------------
set -a
PATH=/usr/bin:/path/to/fping
FPINGOPTS="$*"
FACILITY="LOCAL1"
PRIORITY="INFO"
fping $FPINGOPTS | while read RESPONSE
do
logger -p ${FACILITY}.${PRIORITY} -t FPING "$RESPONSE"
done
##------------------------------------------------------------------------------
## syserr - A wrapper to syslog the stderr stream of any program.
##
## Peter L. Buschman <plb@concentric.net>
## 07/27/1998
##------------------------------------------------------------------------------
set -a
PATH=/usr/bin:/path/to/program
PROGRAM="myprogram"
PROGOPTS="$*"
FACILITY="LOCAL1"
PRIORITY="INFO"
SCRATCH="/tmp/scratch.$$"
$PROGRAM $PROGOPTS 2> $SCRATCH
cat $SCRATCH | while read RESPONSE
do
logger -p ${FACILITY}.${PRIORITY} -t "$PROGRAM" "$RESPONSE"
done
rm $SCRATCH
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:45 CDT