Commit cc6d6fa7 authored by Mike Hibler's avatar Mike Hibler

Uniform syslog'ing. Change everything I could find to use a syslog facility

as defined in the defs-* file (e.g. "TBLOGFACIL=local2").  The default is
"local5" which is what we are setup to use so you shouldn't need to mess
with your defs- file!

perl scripts just get this value configured in when configure is run.
C programs get the value in two ways.  For programs that are intimate with
the testbed infrastructure, and include "config.h", they just get it from
that file.  For programs that we sometimes use outside the Emulab build
environment (e.g., frisbee, capture) and that don't include config.h,
the value is set via a "-DLOG_TESTBED=..." in the GNUmakefile build line.
If the value isn't set, it defaults to what it used to be (usually LOG_USER).

Still to do: healthd, hmcd (whose build doesn't seem to be completely
integrated) and plabdaemon.in (since its icky python :-)
parent 120f0a51
......@@ -53,3 +53,5 @@ INSTALL_DATA = @INSTALL@ -m 444
CLIENT_ETCDIR = @CLIENT_ETCDIR@
CLIENT_BINDIR = @CLIENT_BINDIR@
CLIENT_VARDIR = @CLIENT_VARDIR@
LOG_TESTBED = @LOG_TESTBED@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -25,7 +25,7 @@ DESTDIR=
# Define LOG_DROPS to record warnings in syslog whenever chars were dropped
# due to the output device/pty being full.
#
CFLAGS= -g -O2 -DLOG_DROPS -I${OBJDIR}
CFLAGS= -g -O2 -DLOG_DROPS -I${OBJDIR} -DLOG_TESTBED=$(LOG_TESTBED)
capture: capture.c capdecls.h
cc $(CFLAGS) -DUSESOCKETS -DWITHSSL -DPREFIX=\"$(TBROOT)\" -o capture $< -lssl -lcrypto
......@@ -50,4 +50,4 @@ real-install: all $(INSTALL_SBINDIR)/capserver $(INSTALL_SBINDIR)/capture
tipserv-install: tipserv-all $(INSTALL_SBINDIR)/capture
clean:
rm -f *.o capture core errs Errs
rm -f *.o capture capture-tty capserver core errs Errs
......@@ -78,7 +78,7 @@ main(int argc, char **argv)
if (argc)
usage();
openlog("capserver", LOG_PID, LOG_USER);
openlog("capserver", LOG_PID, LOG_TESTBED);
syslog(LOG_NOTICE, "daemon starting");
if (!debug)
......
......@@ -50,9 +50,9 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
#endif /* WITHSSL */
#include "config.h"
#endif /* USESOCKETS */
#include "capdecls.h"
#include "config.h"
#define geterr(e) strerror(e)
......@@ -73,6 +73,10 @@ void dolog(int level, char *format, ...);
#define revoke(tty) (0)
#endif
#ifndef LOG_TESTBED
#define LOG_TESTBED LOG_USER
#endif
/*
* Configurable things.
*/
......@@ -209,7 +213,7 @@ main(int argc, char **argv)
(void) sprintf(strbuf, DEVNAME, DEVPATH, argv[1]);
Devname = newstr(strbuf);
openlog(Progname, LOG_PID, LOG_USER);
openlog(Progname, LOG_PID, LOG_TESTBED);
dolog(LOG_NOTICE, "starting");
/*
......
......@@ -18,3 +18,4 @@
#undef FSDIR_USERS
#undef FSDIR_SHARE
#undef SFSSUPPORT
#undef LOG_TESTBED
......@@ -51,6 +51,7 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
sitefile=
srcdir=
target=NONE
verbose=
......@@ -165,6 +166,7 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
......@@ -335,6 +337,11 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
-site-file | --site-file | --site-fil | --site-fi | --site-f)
ac_prev=sitefile ;;
-site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
sitefile="$ac_optarg" ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
......@@ -500,12 +507,16 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
if test -z "$sitefile"; then
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
else
CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
......@@ -573,7 +584,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:577: checking host system type" >&5
echo "configure:588: checking host system type" >&5
host_alias=$host
case "$host_alias" in
......@@ -594,7 +605,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:598: checking build system type" >&5
echo "configure:609: checking build system type" >&5
build_alias=$build
case "$build_alias" in
......@@ -620,7 +631,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:624: checking for $ac_word" >&5
echo "configure:635: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -652,7 +663,7 @@ fi
# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
set dummy ${ac_tool_prefix}g++; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:656: checking for $ac_word" >&5
echo "configure:667: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -684,7 +695,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:688: checking for $ac_word" >&5
echo "configure:699: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -716,7 +727,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:720: checking for $ac_word" >&5
echo "configure:731: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -748,7 +759,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:752: checking for $ac_word" >&5
echo "configure:763: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -780,7 +791,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ssh", so it can be a program name with args.
set dummy ${ac_tool_prefix}ssh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:784: checking for $ac_word" >&5
echo "configure:795: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SSH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -853,6 +864,7 @@ fi
#
......@@ -894,6 +906,7 @@ JAILIPMASK=255.240.0.0
IPBASE=10
SFSSUPPORT=1
PLABSUPPORT=0
TBLOGFACIL="local5"
#
# Okay, I know this is improper usage of --with. Too bad.
......@@ -984,6 +997,13 @@ EOF
fi
LOG_TESTBED=`echo "LOG_$TBLOGFACIL" | tr a-z A-Z`
cat >> confdefs.h <<EOF
#define LOG_TESTBED $LOG_TESTBED
EOF
#
# The email addresses need to be be munged for perl scripts. But,
# php needs them un-escaped
......@@ -1266,7 +1286,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1270: checking for a BSD compatible install" >&5
echo "configure:1290: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -1605,6 +1625,7 @@ s%@TBAUTHTIMEOUT@%$TBAUTHTIMEOUT%g
s%@TBMAINSITE@%$TBMAINSITE%g
s%@SFSSUPPORT@%$SFSSUPPORT%g
s%@PLABSUPPORT@%$PLABSUPPORT%g
s%@TBLOGFACIL@%$TBLOGFACIL%g
s%@TBOPSEMAIL@%$TBOPSEMAIL%g
s%@TBOPSEMAIL_NOSLASH@%$TBOPSEMAIL_NOSLASH%g
s%@TBLOGSEMAIL@%$TBLOGSEMAIL%g
......@@ -1625,6 +1646,7 @@ s%@TBACTIVEARCHIVE@%$TBACTIVEARCHIVE%g
s%@TBACTIVEARCHIVE_NOSLASH@%$TBACTIVEARCHIVE_NOSLASH%g
s%@TBUSERSARCHIVE@%$TBUSERSARCHIVE%g
s%@TBUSERSARCHIVE_NOSLASH@%$TBUSERSARCHIVE_NOSLASH%g
s%@LOG_TESTBED@%$LOG_TESTBED%g
s%@LEDA@%$LEDA%g
s%@ASSIGN@%$ASSIGN%g
s%@SSH_ARGS@%$SSH_ARGS%g
......
......@@ -57,6 +57,7 @@ AC_SUBST(TBAUTHTIMEOUT)
AC_SUBST(TBMAINSITE)
AC_SUBST(SFSSUPPORT)
AC_SUBST(PLABSUPPORT)
AC_SUBST(TBLOGFACIL)
#
# Offer both versions of the email addresses that have the @ escaped
......@@ -97,6 +98,7 @@ JAILIPMASK=255.240.0.0
IPBASE=10
SFSSUPPORT=1
PLABSUPPORT=0
TBLOGFACIL="local5"
#
# Okay, I know this is improper usage of --with. Too bad.
......@@ -143,6 +145,10 @@ if test -n "$FSDIR_SHARE"; then
AC_DEFINE_UNQUOTED(FSDIR_SHARE, "$FSDIR_SHARE")
fi
LOG_TESTBED=`echo "LOG_$TBLOGFACIL" | tr a-z A-Z`
AC_DEFINE_UNQUOTED(LOG_TESTBED, $LOG_TESTBED)
AC_SUBST(LOG_TESTBED)
#
# The email addresses need to be be munged for perl scripts. But,
# php needs them un-escaped
......
......@@ -29,6 +29,7 @@ my $REALTBDBNAME = "tbdb"; # So we know if we're using the "real" db
my $osselect = "$TB/bin/os_select";
my $nodereboot = "$TB/bin/node_reboot";
my $power = "$TB/bin/power";
my $TBLOG = "@TBLOGFACIL@";
$| = 1;
......@@ -157,7 +158,7 @@ if (!$debug) {
}
}
# set up syslog
openlog("stated","pid","user");
openlog("stated","pid",$TBLOG);
sysopen(PIDFILE, $pidfile, O_WRONLY | O_EXCL | O_CREAT) ||
fatal("Couldn't create '$pidfile': $? $!\n");
print PIDFILE "$$";
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -16,6 +16,7 @@
#include <syslog.h>
#include <assert.h>
#include <errno.h>
#include "config.h"
#include "log.h"
static int usesyslog = 0;
......@@ -31,7 +32,7 @@ loginit(int slog, char *name)
usesyslog = 1;
if (! name)
name = "Testbed";
openlog(name, LOG_PID, LOG_USER);
openlog(name, LOG_PID, LOG_TESTBED);
return 0;
}
......
......@@ -64,6 +64,9 @@ frisbeed: $(SERVEROBJS)
strip frisbeed
log.o: $(SRCDIR)/log.c decls.h log.h
$(CC) $(CFLAGS) -DLOG_TESTBED=$(LOG_TESTBED) -c $(SRCDIR)/log.c
event.o: $(SRCDIR)/event.c decls.h log.h event.h
$(CC) $(EVENTFLAGS) -c $(SRCDIR)/event.c
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -17,6 +17,10 @@
#include <errno.h>
#include "decls.h"
#ifndef LOG_TESTBED
#define LOG_TESTBED LOG_USER
#endif
static int usesyslog = 1;
/*
......@@ -38,7 +42,7 @@ ServerLogInit(void)
return 1;
}
openlog("frisbeed", LOG_PID, LOG_USER);
openlog("frisbeed", LOG_PID, LOG_TESTBED);
return 0;
}
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -30,16 +30,11 @@ PR_DBOBJ = proxydhcp_cfile.o proxydhcp_mysql.o
INCS = -I/usr/local/include
#ifeq "$(filter -DLBS, $(CFLAGS))" "-DLBS"
#INCS += -I/build/oskit-debug/install/include
#else
#INCS += -I/n/moab/z/mike/flux/install.debug/include
#endif
CFLAGS += $(INCS) $(DBFLAG) -DSOLARIS -DHAVE_SOCKADDR_SA_LEN -DUSE_RECVMSG \
-DCONFPATH='"$(INSTALL_ETCDIR)/"' -DTBDBNAME='"$(TBDBNAME)"' \
-DFALLBACK_HOST='"$(BOSSNODE)"' -DBOSSNODE='"$(BOSSNODE)"' \
-DDEFAULT_PATH='"/tftpboot/pxeboot.newnode"'
-DDEFAULT_PATH='"/tftpboot/pxeboot.newnode"' \
-DLOG_TESTBED=$(LOG_TESTBED)
ifeq ($(EVENTSYS),1)
CFLAGS += -DEVENTSYS -I$(TESTBED_SRCDIR)/event/lib \
......@@ -84,4 +79,4 @@ install: $(INSTALL_SBINDIR)/proxydhcp \
$(INSTALL_ETCDIR)/bootinfo.conf
clean:
rm -f *.o core proxydhcp bootinfo testmysql
rm -f *.o core proxydhcp bootinfo *.restart testmysql
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -23,7 +23,7 @@ main()
boot_info_t boot_info;
boot_what_t *boot_whatp = (boot_what_t *) &boot_info.data;
openlog("bootinfo", LOG_PID, LOG_USER);
openlog("bootinfo", LOG_PID, LOG_TESTBED);
syslog(LOG_NOTICE, "daemon starting (version %d)", version);
(void)daemon(0, 0);
......
......@@ -358,7 +358,7 @@ main(int argc, char *argv[])
argn=2;
}
openlog("proxydhcp", LOG_PID, LOG_USER);
openlog("proxydhcp", LOG_PID, LOG_TESTBED);
syslog(LOG_NOTICE,
"Minimal PXE Proxy DHCP daemon, for use with BpBatch");
syslog(LOG_NOTICE, "By David Clerc & Marc Vuilleumier Stuckelberg"
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -38,6 +38,7 @@ genlastlog: genlastlog.c
-DUSERSVAR='"$(prefix)/usersvar"' \
-DOURDOMAIN='"$(OURDOMAIN)"' \
-DUSERNODE='"$(USERNODE)"' \
-DLOG_TESTBED=$(LOG_TESTBED) \
-o genlastlog $< -L/usr/local/lib/mysql -lmysqlclient
install: $(addprefix $(INSTALL_LIBEXECDIR)/, $(BINS)) \
......@@ -54,4 +55,4 @@ post-install:
control-install: $(addprefix $(INSTALL_BINDIR)/, plasticwrap)
clean:
rm -f *.o $(BINS) core
rm -f *.o $(BINS) $(SBINS) $(SCRIPTS) core
......@@ -71,6 +71,10 @@
#define LOGINS "log/logins"
#define SSHD "sshd"
#ifndef LOG_TESTBED
#define LOG_TESTBED LOG_USER
#endif
static char *progname;
static int debug = 0;
static int mydb_update(char *query, ...);
......@@ -121,7 +125,7 @@ main(int argc, char **argv)
if (argc)
usage();
openlog("genlastlog", LOG_PID, LOG_USER);
openlog("genlastlog", LOG_PID, LOG_TESTBED);
syslog(LOG_NOTICE, "genlastlog starting");
/*
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -10,6 +10,10 @@
#include "hmcd.h"
#ifndef LOG_TESTBED
#define LOG_TESTBED LOG_DAEMON
#endif
void AcceptClient(int, int*);
void CollectData(int, HMONENT*);
int EmitData(int, HMONENT*);
......@@ -65,7 +69,7 @@ int main(int argc, char **argv) {
strcpy(unixaddr.sun_path, SOCKPATH);
if (strchr(argv[0], '/')) {
openlog(strrchr(argv[0], '/')+1, 0, LOG_DAEMON);
openlog(strrchr(argv[0], '/')+1, 0, LOG_TESTBED);
}
else {
openlog(argv[0], 0, LOG_DAEMON);
......
......@@ -18,7 +18,8 @@ include $(OBJDIR)/Makeconf
CC?=gcc
CFLAGS+= -Wall -I${OBJDIR} -I/usr/local/include -I$(TESTBED_SRCDIR)/lib/libtb \
-DCLIENT_BINDIR='"$(CLIENT_BINDIR)"'
-DCLIENT_BINDIR='"$(CLIENT_BINDIR)"' \
-DLOG_TESTBED=$(LOG_TESTBED)
LDFLAGS+= -L${OBJDIR}/lib/libtb -L/usr/local/lib/mysql
SDLIBS+= -ltb -lmysqlclient
LIBS=
......@@ -60,4 +61,5 @@ client-install:
$(INSTALL_PROGRAM) $(SLOTHD_DIR)/slothd $(DESTDIR)$(CLIENT_BINDIR)
clean:
rm -f *.o $(SDPROGS) *~ core *.core version.c
rm -f *.o $(SDPROGS) $(SBIN_SCRIPTS) *~ core *.core version.c
rm -rf fbsdclient linuxclient
......@@ -281,7 +281,7 @@ DIR *devs;
signal(SIGSYS, sigunkhandler);
/* Setup logging facil. */
openlog("slothd", LOG_NDELAY, LOG_DAEMON);
openlog("slothd", LOG_NDELAY, LOG_TESTBED);
/* Setup path */
if (setenv("PATH", SLOTHD_PATH_ENV, 1) < 0) {
......
......@@ -63,6 +63,10 @@
#define SLOTHD_DEF_SERV "boss"
#define SLOTHD_DEF_PORT 8509 /* XXX change */
#ifndef LOG_TESTBED
#define LOG_TESTBED LOG_DAEMON
#endif
#ifdef __FreeBSD__
#define CNTFMTSTR "%s %*s %*s %s %lu %*s %lu"
#define NUMSCAN 4
......
......@@ -33,6 +33,7 @@ $| = 1; #Turn off line buffering on output
# Configure variables
my $TB = "@prefix@";
my $TBOPS = "@TBSTATEDEMAIL@";
my $TBLOG = "@TBLOGFACIL@";
# Testbed Support libraries
use lib "@prefix@/lib";
......@@ -54,7 +55,7 @@ my $pathmode=0; # is osid really a path instead of an osid?
my $mfs=0; # is this for a pxe_boot_path change?
# Set up syslog
openlog("osselect","pid","user");
openlog("osselect","pid",$TBLOG);
# Find default pxe boot path
my $cmd = "select path from os_info where osid='".TB_OSID_PXEBOOT."'";
......
......@@ -80,4 +80,4 @@ ${OBJDIR}/lib/libtb/%:
cd ${OBJDIR}/lib/tbdb && gmake $<
clean:
rm -f *.o core tmcd tmcc tmcc-nossl findif version.c
rm -f *.o core tmcd tmcd.restart tmcc tmcc-nossl findif version.c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment