Accepting request 140731 from home:mtomaschewski:branches:Base:System

Replaced SYSLOG_DAEMON switch with syslog.service alias. Werner, please review

OBS-URL: https://build.opensuse.org/request/show/140731
OBS-URL: https://build.opensuse.org/package/show/Base:System/syslogd?expand=0&rev=88
This commit is contained in:
Marius Tomaschewski 2012-11-09 17:29:09 +00:00 committed by Git OBS Bridge
parent 248cbaf437
commit 9082307de8
12 changed files with 235 additions and 900 deletions

View File

@ -11,7 +11,8 @@
# other by all syslog daemons.
# the mail log files are used by all syslog daemons
# the news log files are used by all syslog daemons
/var/log/warn /var/log/messages /var/log/allmessages /var/log/localmessages /var/log/firewall /var/log/acpid /var/log/NetworkManager
/var/log/warn /var/log/messages /var/log/allmessages /var/log/localmessages
/var/log/firewall /var/log/acpid /var/log/NetworkManager
/var/log/mail /var/log/mail.info /var/log/mail.warn /var/log/mail.err
/var/log/news/news.crit /var/log/news/news.err /var/log/news/news.notice
{
@ -25,6 +26,6 @@
create 640 root root
sharedscripts
postrotate
/etc/init.d/syslog reload > /dev/null
/usr/bin/systemctl reload syslog.service > /dev/null
endscript
}

View File

@ -1,112 +0,0 @@
#! /bin/sh
#
# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2002-2003 SuSE Linux AG, Nuernberg, Germany.
# Copyright (c) 2004-2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# Author: Florian La Roche <florian@suse.de>, 1996
# Werner Fink <werner@suse.de>, 1998-2008
# Stephan Kulow <coolo@suse.de>, 2005-2008
# Marius Tomaschewski <mt@suse.de>, 2001-2008
#
# /etc/init.d/syslog
#
### BEGIN INIT INFO
# Provides: earlysyslog
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop:
# Description: Start the system logging daemons
### END INIT INFO
. /etc/sysconfig/syslog
BINDIR=/sbin
if type -t rc_readonlyroot > /dev/null 2>&1 && rc_readonlyroot ; then
echo "Disabling early syslog on read-only root filesystem."
exit 0
fi
# update $SYSLOG_DAEMON if not up-to-date
test -n "$SYSLOG_DAEMON" && \
test -x "${BINDIR}/$SYSLOG_DAEMON" || {
for SYSLOG_DAEMON in rsyslogd syslog-ng syslogd ; do
test -x "${BINDIR}/$SYSLOG_DAEMON" && break
done
}
# set daemon dependent variables
case "$SYSLOG_DAEMON" in
rsyslogd)
syslog=rsyslogd
config=/etc/rsyslog.conf
;;
syslog-ng)
syslog=syslog-ng
config=/etc/syslog-ng/syslog-ng.conf
;;
*)
syslog=syslogd
config=/etc/syslog.conf
;;
esac
syslog_bin=${BINDIR}/$syslog
klog_bin=${BINDIR}/klogd
# check config and programs
test -s ${config} || {
echo 1>&2 "${config} does not exist"
if test "$1" == "stop" ; then exit 0 ; else exit 6 ; fi
}
test -x ${syslog_bin} || {
echo 1>&2 "${syslog_bin} is not installed"
if test "$1" == "stop" ; then exit 0 ; else exit 5 ; fi
}
test -x ${klog_bin} || {
echo 1>&2 "${klog_bin} is not installed"
if test "$1" == "stop" ; then exit 0 ; else exit 5 ; fi
}
case "$SYSLOG_DAEMON" in
syslog-ng)
case ${SYSLOG_REQUIRES_NETWORK} in
yes) exit 0 ;;
no) ;;
"")
while read line ; do
case "$line" in
\#*|"") continue ;;
*udp\ *|*udp\(*) exit 0 ;;
*tcp\ *|*tcp\(*) exit 0 ;;
esac
done < ${config}
;;
esac
;;
rsyslogd)
# Network is usually not required for properly configured
# rsyslogd with enabled on-disk queues for remote logging,
# so we just start it with its normal configuration.
# "yes" allows the user to disable the early start.
case ${SYSLOG_REQUIRES_NETWORK} in
yes) exit 0 ;;
no|"") ;;
esac
;;
*)
case ${SYSLOG_REQUIRES_NETWORK} in
yes) exit 0 ;;
no) ;;
"")
while read select action ; do
case "$select" in \#*|"") continue ;; esac
case "$action" in *@*) exit 0 ;; esac
done < ${config}
;;
esac
;;
esac
exec /etc/init.d/syslog $1 early

257
rc.syslog
View File

@ -1,255 +1,18 @@
#! /bin/sh
#!/bin/sh
#
# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2002-2003 SuSE Linux AG, Nuernberg, Germany.
# Copyright (c) 2004-2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# Author: Florian La Roche <florian@suse.de>, 1996
# Werner Fink <werner@suse.de>, 1998-2008
# Stephan Kulow <coolo@suse.de>, 2005-2008
# Marius Tomaschewski <mt@suse.de>, 2001-2008
# Author:
# Werner Fink <werner@suse.de>
# Marius Tomaschewski <mt@suse.de>
#
# /etc/init.d/syslog
# Description:
# Compatibility script triggering a "systemctl <action> syslog.service"
# redirection using rc.status.
#
### BEGIN INIT INFO
# Provides: syslog
# Required-Start:
# Should-Start: earlysyslog network
# Required-Stop:
# Should-Stop: earlysyslog network
# Default-Start: 2 3 5
# Default-Stop:
# Description: Start the system logging daemons
### END INIT INFO
. /etc/sysconfig/syslog
BINDIR=/sbin
# update $SYSLOG_DAEMON if not up-to-date
test -n "$SYSLOG_DAEMON" && \
test -x "${BINDIR}/$SYSLOG_DAEMON" || {
for SYSLOG_DAEMON in rsyslogd syslog-ng syslogd ; do
test -x "${BINDIR}/$SYSLOG_DAEMON" && break
done
}
# set daemon dependent variables
rsocks=""
start_klogd=yes
case "$SYSLOG_DAEMON" in
rsyslogd)
syslog=rsyslogd
config=/etc/rsyslog.conf
compat=${RSYSLOGD_COMPAT_VERSION:-${RSYSLOGD_NATIVE_VERSION}}
params="-c ${compat:-3} -f $config $RSYSLOGD_PARAMS"
rsocks="/var/run/rsyslog/additional-log-sockets.conf"
mkdir -p -m 0755 /var/run/rsyslog
test -r "$config" && \
while read one two rest ; do
test "x$one" = 'x$ModLoad' && \
test "x$two" = 'ximklog.so' && {
start_klogd=no
break
}
done < $config
;;
syslog-ng)
syslog=syslog-ng
config=/etc/syslog-ng/syslog-ng.conf
params="$SYSLOG_NG_PARAMS"
ngsocks="/var/run/syslog-ng/additional-log-sockets.conf"
ngsocksdir="/var/run/syslog-ng"
mkdir -p -m 0755 $ngsocksdir
test -r "$config" && \
while read line; do
case $line in file*/proc/kmsg*)
start_klogd=no ; break ;;
esac
done < $config
;;
*)
syslog=syslogd
config=/etc/syslog.conf
params="$SYSLOGD_PARAMS"
;;
esac
syslog_pid="/var/run/${syslog}.pid"
syslog_bin=${BINDIR}/$syslog
klog_bin=${BINDIR}/klogd
syslog_use=""
# check config and programs
test -s ${config} || {
echo "${config} does not exist" 1>&2
test "$1" == "stop" && exit 0
exit 6
}
test -x ${syslog_bin} || {
echo "${syslog_bin} is not installed" 1>&2
test "$1" == "stop" && exit 0
exit 5
}
test ! -x ${klog_bin} -a "$start_klogd" = yes && {
echo "${klog_bin} is not installed" 1>&2
test "$1" == "stop" && exit 0
exit 5
}
test -s /run/rcsyslog && {
read -t 5 syslog_use < /run/rcsyslog
}
test -z "$syslog_use" && syslog_use=${syslog_bin}
syslog_use_pid="/var/run/${syslog_use##*\/}.pid"
#
# Do not translate symbol addresses for 2.6 kernel
#
case "$(uname -r)" in
[01].*|2.[0-4].*) ;;
*) case "$KLOGD_PARAMS" in
*-x*) ;;
*) KLOGD_PARAMS="${KLOGD_PARAMS:+$KLOGD_PARAMS }-x" ;;
esac ;;
esac
. /etc/rc.status
rc_reset
case "$1" in
start)
if test -e /run/rcearlysyslog ; then
# Syslog service already done
rm -f /run/rcearlysyslog
case "$SYSLOG_DAEMON" in
rsyslogd) ;; # switch to normal config
*) exit 0 ;;
esac
elif test "$2" = "early" ; then
# Start syslog service early
> /run/rcearlysyslog
fi
if ! test -e /dev/xconsole ; then
mknod -m 0600 /dev/xconsole p
chown root:tty /dev/xconsole
fi
killproc -p /var/run/klogd.pid ${klog_bin}
if test -s ${syslog_use_pid} ; then
killproc -p ${syslog_use_pid} ${syslog_use}
echo -n "Re-"
rm -f /run/rcsyslog
fi
echo -n "Starting syslog services"
test -z "$KERNEL_LOGLEVEL" && KERNEL_LOGLEVEL=1
echo "Usage: /sbin/rcsyslog {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
case $syslog in
rsyslogd)
if test -n "$rsocks" ; then
rm -f "$rsocks"
touch "$rsocks"
fi
;;
syslog-ng)
echo 'source chroots{' > "$ngsocks"
;;
esac
# add additional sockets to params or similar
for variable in ${!SYSLOGD_ADDITIONAL_SOCKET*}; do
eval value=\$$variable
test -n "${value}" && test -d ${value%/*} && {
case $syslog in
rsyslogd)
if test -n "$rsocks" ; then
echo "\$AddUnixListenSocket $value" >> "$rsocks"
fi
;;
syslog-ng)
echo "unix-dgram(\"$value\");" >> "$ngsocks"
;;
*)
params="$params -a $value"
;;
esac
}
done
case $syslog in
syslog-ng)
echo "};" >> "$ngsocks"
;;
esac
startproc -p ${syslog_pid} ${syslog_bin} ${params}
rc_status
# Remember the currently used syslog daemon
echo ${syslog_bin} > /run/rcsyslog
if test $? -eq 0 ; then
if test "$start_klogd" = yes ; then
startproc ${klog_bin} -c $KERNEL_LOGLEVEL $KLOGD_PARAMS
rc_status
fi
fi
rc_status -v
;;
stop)
rm -f /run/rcearlysyslog
test "$2" = "early" && exit 0
echo -n "Shutting down syslog services"
if test "$start_klogd" = yes ; then
killproc ${klog_bin} ; rc_status
else
killproc ${klog_bin}
fi
killproc -p ${syslog_use_pid} ${syslog_use} ; rc_status -v
rm -f /run/rcsyslog
;;
try-restart|condrestart)
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} instead${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload|force-reload)
echo -n "Reload syslog service"
if test "$start_klogd" = yes ; then
killproc -TSTP ${klog_bin} ; rc_status
killproc -p ${syslog_use_pid} -HUP ${syslog_use} ; rc_status
killproc -CONT ${klog_bin} ; rc_status
killproc -USR2 ${klog_bin} ; rc_status -v
else
killproc -p ${syslog_use_pid} -HUP ${syslog_use} ; rc_status -v
fi
;;
status)
echo -n "Checking for service syslog:"
if test "$start_klogd" = yes ; then
checkproc ${klog_bin} ; rc_status
fi
checkproc -p ${syslog_use_pid} ${syslog_use} ; rc_status -v
;;
probe)
if test "${syslog_use_pid}" != "${syslog_pid}" ; then
echo restart
else
# Note: does not work when an included rsyslog config changed
test ${config} -nt ${syslog_pid} && echo reload
fi
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit

View File

@ -1,30 +0,0 @@
## Path: System/Logging
## Description: System logging
## Type: list(syslogd,syslog-ng,rsyslogd,"")
## Default: ""
## Config: ""
## ServiceRestart: syslog
#
# The name of the syslog daemon to use as syslog service:
# "syslogd", "syslog-ng", "rsyslogd" or "" for autodetect.
#
SYSLOG_DAEMON=""
## Type: list(yes,no,"")
## Default: ""
## Config: ""
## ServiceRestart: syslog
#
# Specify whether the syslog configuration requires network.
# Set to "yes" to delay the syslog daemon start until network
# is already started, set to "no" to start it earlier.
#
# The behavior of the default setting "" depends on the daemon
# specified in the SYSLOG_DAEMON variable and on the current
# implementation of the init / systemd scripts. It may cause
# a try to detect whether network is required for the config
# or choose one of the above modi.
#
SYSLOG_REQUIRES_NETWORK=""

View File

@ -1,339 +0,0 @@
#!/bin/bash
#
# /lib/systemd/system-generator/syslog-service-generator
#
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
#
# Description:
#
# Write out syslog.core and if required enable klogd.service
# depending on the configuration found in /etc/sysconfig/syslog.
# Also check if network target is required with this we do not
# required the earlysyslog hack anymore.
# Based on the /etc/init.d/syslog SysV init boot script as well
# as on the /etc/init.d/earlysyslog wrapper script.
#
# Author: Werner Fink
# Please send feedback to http://www.suse.de/feedback
#
umask 0022
TMPDIR=/run
export TMPDIR
: ${SBINDIR:=/sbin}
: ${RUN_PATH:=/run/systemd}
: ${SYSUNITDIR:=/lib/systemd/system}
: ${SYSCONFDIR:=/etc/systemd/system}
if test -s /etc/sysconfig/syslog ; then
CORE=$RUN_PATH/syslog.core
test -s $CORE -a $CORE -nt /etc/sysconfig/syslog && exit 0
. /etc/sysconfig/syslog
else
SYSLOG_DAEMON=rsyslogd
fi
#
# Danger Robinson: do not touch anything if a System logger
# is running under the control of systemd its self!
#
if test -d /sys/fs/cgroup/systemd/system/syslog.service -o \
-d /sys/fs/cgroup/systemd/system/klogd.service
then
/bin/logger -i -p daemon.warn -t ${0##*/} \
'Stop syslog.service before reloading the daemons!'
exit 1
fi
#
# Update $SYSLOG_DAEMON if not up-to-date
#
if test -z "$SYSLOG_DAEMON" -o ! -x "$SBINDIR/$SYSLOG_DAEMON" ; then
for SYSLOG_DAEMON in rsyslogd syslog-ng syslogd ; do
test -x "$SBINDIR/$SYSLOG_DAEMON" && break
done
fi
#
# Simple helper for correct permissions of the socket
#
touch ()
{
local mask=$(umask)
umask 0066
/bin/touch ${1+"$@"}
umask $mask
}
#
# Default is no network and start klogd
#
network=
start_klogd=yes
klogd=klogd.service
#
# Now check for the three possible system loggers for required
# network connection and for external klogd. Note that /var/run
# does not exist at boot time, therefore files and directories
# will be created below the /run tmpfs.
#
case "$SYSLOG_DAEMON" in
syslog-ng)
syslog=syslog-ng
config=/etc/syslog-ng/syslog-ng.conf
socksdir=/var/run/syslog-ng
socks=$socksdir/additional-log-sockets.conf
case ${SYSLOG_REQUIRES_NETWORK} in
yes) network=network.target ;;
no) ;;
"") # OK, try to detect it; does not
# work with include files ...
if test -s "$config" ; then
while read line ; do
case "$line" in
\#*|"") continue ;;
*udp\ *|*udp\(*) network=network.target ;;
*tcp\ *|*tcp\(*) network=network.target ;;
esac
done < ${config}
fi
;;
esac
if test -r "$config" ; then
while read line; do
case $line in
file*/proc/kmsg*)
start_klogd=no
break
esac
done < $config
fi
/bin/mkdir -p -m 0755 ${socksdir#/var}
touch ${socks#/var}
params="$SYSLOG_NG_PARAMS"
;;
rsyslogd)
syslog=rsyslogd
config=/etc/rsyslog.conf
socksdir=/var/run/rsyslog
socks=$socksdir/additional-log-sockets.conf
# Network is usually not required for properly configured
# rsyslogd with enabled on-disk queues for remote logging,
# so we just start it with its normal configuration.
# "yes" allows the user to disable the early start.
case ${SYSLOG_REQUIRES_NETWORK} in
yes) network=network.target ;;
esac
if test -r "$config" ; then
while read one two rest ; do
if test "$one" = '$ModLoad' -a "$two" = 'imklog.so' ; then
start_klogd=no
break
fi
done < $config
fi
/bin/mkdir -p -m 0755 ${socksdir#/var}
touch ${socks#/var}
compat=${RSYSLOGD_COMPAT_VERSION:-${RSYSLOGD_NATIVE_VERSION}}
params="-c ${compat:-3} -f $config $RSYSLOGD_PARAMS"
;;
*)
syslog=syslogd
config=/etc/syslog.conf
socksdir=/var/run/syslog
socks=$socksdir/additional-log-sockets.env
network=
case ${SYSLOG_REQUIRES_NETWORK} in
yes) network=network.target ;;
no) ;;
"") # Try to detect it
if test -s "$config" ; then
while read select action ; do
case "$select" in \#*|"") continue ;; esac
case "$action" in *@*) network=network.target ;; esac
done < ${config}
fi
;;
esac
/bin/mkdir -p -m 0755 ${socksdir#/var}
touch ${socks#/var}
params="$SYSLOGD_PARAMS"
esac
syslog_bin=${SBINDIR}/$syslog
klog_bin=${SBINDIR}/klogd
test -s ${config} || exit 1
test -x ${syslog_bin} || exit 1
#
# Make sure that we have a log fifo which is used by X11
#
if test -e /dev/xconsole -a ! -p /dev/xconsole ; then
/bin/rm -f /dev/xconsole
fi
if test ! -e /dev/xconsole ; then
/bin/mknod -m 0600 /dev/xconsole p
/bin/chown root:tty /dev/xconsole
fi
#
# No klogd.service required
#
test "$start_klogd" = no && klogd=
#
# Create a temporary file for syslog.core
#
trap 'rm -f "$service"' EXIT
tmpcore=$(/bin/mktemp $RUN_PATH/syslog.XXXXXXXX) || exit 1
(/bin/cat > $tmpcore)<<-EOF
# Warning: Do not edit as this file has been and will be autogenerated
# by $0
${network:+Requires=$network}
${network:+After=$network}
${klogd:+Requires=$klogd}
${klogd:+Before=$klogd}
[Service]
Type=forking
PIDFile=/var/run/${syslog_bin##*/}.pid
Sockets=syslog.socket
StandardOutput=null
ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service
ExecStartPre=-$socksdir/addsockets
ExecReload=/bin/kill -HUP \$MAINPID
EOF
#
# For additional sockets we use further configuration files
# for rsyslogd and syslog-ng but an envrionment file for syslogd
#
case "$SYSLOG_DAEMON" in
rsyslogd)
(/bin/cat > ${socksdir#/var}/addsockets)<<-EOF
#!/bin/sh
# Warning: Do not edit as this file has been and will be
# autogenerated by $0
test -s /etc/sysconfig/syslog && . /etc/sysconfig/syslog
umask 0022
> $socks
for variable in \${!SYSLOGD_ADDITIONAL_SOCKET*}; do
eval value=\\\$\$variable
test -z "\$value" && continue
test ! -d \${value%/*} && continue
echo "\\\$AddUnixListenSocket \$value"
done >> $socks
EOF
;;
syslog-ng)
(/bin/cat > ${socksdir#/var}/addsockets)<<-EOF
#!/bin/sh
# Warning: Do not edit as this file has been and will be
# autogenerated by $0
test -s /etc/sysconfig/syslog && . /etc/sysconfig/syslog
umask 0022
echo 'source chroots {' > $socks
for variable in \${!SYSLOGD_ADDITIONAL_SOCKET*}; do
eval value=\\\$\$variable
test -z "\$value" && continue
test ! -d \${value%/*} && continue
echo "unix-dgram(\\"\$value\\");"
done >> $socks
echo '};' >> $socks
EOF
;;
*)
(/bin/cat > ${socksdir#/var}/addsockets)<<-EOF
#!/bin/sh
# Warning: Do not edit as this file has been and will be
# autogenerated by $0
test -s /etc/sysconfig/syslog && . /etc/sysconfig/syslog
umask 0022
echo -n 'ADDITIONAL_SOCKET="' > $socks
for variable in \${!SYSLOGD_ADDITIONAL_SOCKET*}; do
eval value=\\\$\$variable
test -z "\$value" && continue
test ! -d \${value%/*} && continue
echo -n "-a \$value "
done >> $socks
echo -n '"' >> $socks
EOF
echo "Environment=ADDITIONAL_SOCKET=" >>$tmpcore
echo "EnvironmentFile=-$socks" 1>>$tmpcore
params="${params:+$params }\$ADDITIONAL_SOCKET"
esac
chmod u+x ${socksdir#/var}/addsockets
#
# If klogd.service is required handle reload of syslog.service efficient
# otherwise we may loose kernel messages or klogd is forwarding kernel
# messages back to systemd as the creator of the system logging socket
# and we would get a message loop.
#
exec 3>&1 1>>$tmpcore
echo "ExecStart=$syslog_bin $params"
if test "$start_klogd" != no ; then
echo "ExecReload=/bin/systemctl kill --signal=TSTP klogd.service"
fi
echo "ExecReload=/sbin/killproc -p /var/run/${syslog_bin##*/}.pid -HUP $syslog_bin"
if test "$start_klogd" != no ; then
echo "ExecReload=/bin/systemctl kill --signal=CONT klogd.service"
echo "ExecReload=/bin/systemctl kill --signal=USR2 klogd.service"
fi
echo
exec 1>&3 3>&-
#
# If klogd.service is required, remove symbolic link for masking out
# otherwise just add the symbolic link
#
klogserv=$SYSCONFDIR/klogd.service
if test "$start_klogd" != no -a -x ${klog_bin} ; then
test -h $klogserv && rm -f $klogserv
else
/bin/ln -sf /dev/null $klogserv
fi
#
# Now enable the service(s) for multi-user target
#
/bin/mv $tmpcore $CORE
if test ! -d $SYSCONFDIR/multi-user.target.wants/ ; then
/bin/mkdir -p $SYSCONFDIR/multi-user.target.wants
fi
syslogserv=$SYSUNITDIR/syslog.service
enableserv=$SYSCONFDIR/multi-user.target.wants/syslog.service
if test ! -h $enableserv ; then
/bin/rm -f $enableserv
/bin/ln -sf $syslogserv $enableserv
fi
klogserv=$SYSUNITDIR/klogd.service
enableserv=$SYSCONFDIR/multi-user.target.wants/klogd.service
disablserv=$SYSCONFDIR/klogd.service
if test "$start_klogd" != no -a -e $klogserv ; then
if test ! -h $enableserv ; then
/bin/rm -f $enableserv
/bin/ln -sf $klogserv $enableserv
fi
if test -h $disablserv ; then
/bin/rm -f $disablserv
fi
else
if test ! -h $disablserv ; then
/bin/rm -f $disablserv
/bin/ln -sf /dev/null $disablserv
fi
if test -h $enableserv ; then
/bin/rm -f $enableserv
fi
fi
#
# end of /lib/systemd/system-generator/syslog-service-generator

View File

@ -6,41 +6,52 @@
syslog-ng, syslogd
.SH DESCRIPTION
There are different syslog daemon implementations
supported as the system's syslog service, currently
.IR syslogd ,
.IR syslog-ng \ and
.IR rsyslogd
supported as the system's syslog service, currently:
.BR syslogd ,
.BR rsyslogd ,
.BR syslog-ng .
The first installed daemon activates itself for the
syslog service. Starting with openSUSE-11.2,
it is
.IR rsyslogd ,
before it was
.IR syslog-ng .
But this depends on the software selection during
the installation.
It depends on the software selection during the installation
which daemon is installed as default.
The name of the daemon used as syslog service is
specified in the
.br
.BR SYSLOG_DAEMON
variable in
.BR /etc/sysconfig/syslog .
Each syslog-daemon provides an own service file, that is:
.BR syslogd.service ,
.BR rsyslogd.service ,
.BR syslog-ng.service .
The first installed daemon activates itself as the syslog service.
The \fIyast2 sysconfig\fR module provides a comfortable
way to switch to another installed daemon and restart
the service.
This service file name should to be used to activate/deactivate one
of them with the \fBsystemctl enable\fR command, for example:
\fBsystemctl enable syslogd.service\fR.
The activation registers the
.BR syslog.service
alias, which provides a common name to start/stop or query status of
the currently active daemon.
The
.BR /etc/init.d/syslog
init script is able to handle all supported daemons.
.BR /etc/sysconfig/syslog
file contains several variables allowing to specify additional
settings, such as start parameters for the daemon or additional
chroot log sockets.
The \fIyast2 sysconfig\fR module provides a comfortable way to
change these settings.
Starting with openSUSE-12.3, the
.BR SYSLOG_DAEMON
variable, which were used to select the daemon before, has been
removed. Also the
.BR SYSLOG_REQUIRES_NETWORK
has been removed and each daemon declares in its service file
whether the network will be started before syslog or not.
.SH BUGS
Please report bugs at <http://www.suse.de/feedback>
.SH AUTHOR
.nf
Juergen Weigert <jw@novell.com>
Marius Tomaschewski <mt@novell.com>
Juergen Weigert <jw@suse.com>
Dr. Werner Fink <werner@suse.com>
Marius Tomaschewski <mt@suse.com>
.SH "SEE ALSO"
.BR sysklogd (8)
.BR syslogd (8)

View File

@ -1,31 +0,0 @@
# /lib/systemd/system/syslog.service
#
# This file is part of package klogd.
#
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
# Author: Werner Fink
# Please send feedback to http://www.suse.de/feedback
#
# Description:
#
# Used to start one of the System Logging Service daemons
# depending on the configuration found in /etc/sysconfig/syslog.
#
[Unit]
Description=System Logging Service
Requires=var-run.mount syslog.target
After=var-run.mount
Before=syslog.target
OnFailure=systemd-kmsg-syslogd.service
Conflicts=syslog-ng.service rsyslog.service
#
# Now systemd include the further dependency rules and
# Service section. This include will be automatically
# updated depending on the configuration.
#
.include /run/systemd/syslog.core
[Install]
WantedBy=multi-user.target

View File

@ -35,21 +35,21 @@ file extension.
6 - program is not configured
7 - program is not running
-->
<startCommand>/sbin/rcsyslog start</startCommand>
<startCommand>/usr/bin/systemctl start syslog.service</startCommand>
<!--
The reStartCommand tag specifies the command line that will be
invoked to restart the service. The return code from this command
must be as specified in the startCommand tag.
-->
<reStartCommand>/sbin/rcsyslog restart</reStartCommand>
<reStartCommand>/usr/bin/systemctl restart syslog.servic</reStartCommand>
<!--
The stopCommand tag specifies the command line that will be
invoked to stop the service. The return code from this command
must be as specified in the startCommand tag.
-->
<stopCommand>/sbin/rcsyslog stop</stopCommand>
<stopCommand>/usr/bin/systemctl stop syslog.service</stopCommand>
<!--
The statusCommand specifies the command line that can be run
@ -61,7 +61,7 @@ file extension.
3 - service not running (unused)
4 - service status unknown :-(
-->
<statusCommand>/sbin/rcsyslog status</statusCommand>
<statusCommand>/usr/bin/systemctl status syslog.service</statusCommand>
<!--
The processInformation tag allows the XML Service provider to
identify the processes that belong to the service. This allows
@ -72,12 +72,17 @@ file extension.
<processInformation>
<name>syslog-ng</name>
<modulePath>/sbin/syslog-ng</modulePath>
<modulePath>/usr/sbin/syslog-ng</modulePath>
</processInformation>
<processInformation>
<name>rsyslogd</name>
<modulePath>/usr/sbin/rsyslogd</modulePath>
</processInformation>
<processInformation>
<name>syslogd</name>
<modulePath>/sbin/syslogd</modulePath>
<modulePath>/usr/sbin/syslogd</modulePath>
</processInformation>
<!--

49
syslogd-service-prepare Normal file
View File

@ -0,0 +1,49 @@
#!/bin/bash
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
#
# Description:
#
# This script is executed by syslogd.service to prepare
# the syslogd daemon start.
# Currently it writes an evirtoment file which contains
# a variable with the additional log socket parameters
# passed to syslogd.
#
# Author: Werner Fink, Marius Tomaschewski
# Please send feedback to http://www.suse.de/feedback
#
test -s "/etc/sysconfig/syslog" && \
. "/etc/sysconfig/syslog"
run_dir="/var/run/syslogd"
env_file="/var/run/syslogd/additional-log-sockets.env"
umask 0022
/bin/mkdir -p -m 0755 "${run_dir}"
#
# Prepare include with sockets in chroot's
# passed as start parameter to the syslogd.
#
echo -n 'ADDITIONAL_SOCKET="' > "${env_file}"
for variable in ${!SYSLOGD_ADDITIONAL_SOCKET*}; do
eval value=\$$variable
test -z "$value" && continue
test ! -d "${value%/*}" && continue
echo -n "-a $value "
done >> "${env_file}"
echo '"' >> "${env_file}"
#
# make sure xconsole exists and is a pipe
#
if test -e /dev/xconsole -a ! -p /dev/xconsole ; then
/bin/rm -f /dev/xconsole
fi
if test ! -e /dev/xconsole ; then
/bin/mknod -m 0600 /dev/xconsole p
/bin/chown root:tty /dev/xconsole
fi
exit 0

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Nov 9 12:26:11 UTC 2012 - mt@suse.com
- Dropped SYSLOG_DAEMON variable from /etc/sysconfig/syslog.
The syslogd package provides a specific syslogd.service file
and creates an alias to syslog.service while activation now.
- Dropped SYSLOG_REQUIRES_NETWORK, syslogd requires network.
- Updated documentation in syslog.8 manual page.
- Adopted logrotation and svcinfo files to use systemctl.
- Dropped /etc/init.d/syslog and earlysyslog init scripts,
added /sbin/rcsyslog as compatibility forwarder to systemctl.
- Changed to install in /usr/sbin, compatibility link in /sbin.
- Changed to use _unitdir macro to install systemd unit files.
-------------------------------------------------------------------
Thu Oct 18 09:51:21 UTC 2012 - coolo@suse.com

45
syslogd.service Normal file
View File

@ -0,0 +1,45 @@
#
# This file is part of package syslogd.
#
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
# Author: Werner Fink, Marius Tomaschewski
# Please send feedback to http://www.suse.de/feedback
#
# Description:
#
# Used to start syslogd as the System Logging Service daemon.
# The SYSLOG_DAEMON variable in /etc/sysconfig/syslog is not
# used any longer, instead use
# systemctl enable syslogd.service
# which also installs an alias to syslog.service.
#
[Unit]
Description=System Logging Service
Conflicts=syslog-ng.service rsyslog.service
Requires=var-run.mount
Requires=syslog.target
Requires=network.target
Requires=klogd.service
Before=syslog.target
Before=klogd.service
After=var-run.mount
After=network.target
[Service]
Type=forking
PIDFile=/var/run/syslogd.pid
Sockets=syslog.socket
StandardOutput=null
Environment=ADDITIONAL_SOCKET=
ExecStartPre=/usr/sbin/syslogd-service-prepare
EnvironmentFile=-/var/run/syslogd/additional-log-sockets.env
ExecStart=/usr/sbin/syslogd ${ADDITIONAL_SOCKET}
ExecReload=/bin/systemctl kill --signal=TSTP klogd.service
ExecReload=/sbin/killproc -p /var/run/syslogd.pid -HUP /usr/sbin/syslogd
ExecReload=/bin/systemctl kill --signal=CONT klogd.service
ExecReload=/bin/systemctl kill --signal=USR2 klogd.service
[Install]
WantedBy=multi-user.target
Alias=syslog.service

View File

@ -21,16 +21,18 @@ Name: syslogd
%define omc_svcdir %{omc_prefix}/svcinfo.d
BuildRequires: pkg-config
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%define sysdsysunitdir %{_unitdir}
Requires(post): %fillup_prereq
Requires(post): %insserv_prereq
Requires(post): permissions
Requires(postun): %insserv_prereq
Requires(prereq): coreutils
Requires(prereq): klogd
Requires(prereq): sed
Requires(prereq): syslog-service
Provides: sysklogd
Provides: syslog
Provides: sysvinit(syslog)
Conflicts: otherproviders(syslog)
Version: 1.4.1
Release: 0
Summary: The Syslog daemon
@ -38,17 +40,15 @@ License: GPL-2.0+
Group: System/Daemons
Source: sysklogd-1.4.1.tar.bz2
Source1: logrotate.syslog
Source2: sysconfig.syslog
Source3: sysconfig.syslogd
Source4: sysconfig.klogd
Source5: rc.syslog
Source6: rc.earlysyslog
Source7: syslog.xml
Source8: syslog.8
Source9: syslog-service-generator
Source10: klogd.service
Source11: syslog.service
Source12: klog.service
Source2: sysconfig.syslogd
Source3: sysconfig.klogd
Source4: syslog.xml
Source5: syslog.8
Source6: klog.service
Source7: klogd.service
Source8: syslogd.service
Source9: syslogd-service-prepare
Source10: rc.syslog
Patch0: sysklogd-1.4.1.dif
Patch1: sysklogd-1.4.1-dgram.patch
Patch2: sysklogd-1.4.1-sparc.patch
@ -77,8 +77,6 @@ Patch24: sysklogd-1.4.1-systemd.dif
Patch25: sysklogd-1.4.1-systemd-multi.dif
Patch26: sysklogd-1.4.1-systemd-sock-name.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{expand: %%global sysdsysunitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
%{expand: %%global sysdsysconfdir %(pkg-config systemd --variable=systemdsystemconfdir)}
%description
The syslogd daemon is the general system logging daemon, which is
@ -98,9 +96,7 @@ Authors:
%package -n klogd
Provides: klogd:/sbin/klogd
Requires(post): %fillup_prereq
Requires(post): %insserv_prereq
Requires(postun): %insserv_prereq
Requires(post): %fillup_prereq
Summary: The kernel log daemon
Group: System/Daemons
@ -121,12 +117,10 @@ Authors:
Shane Alderton <shane@scs.apana.org.au>
%package -n syslog-service
Requires(post): %fillup_prereq
Requires(post): %insserv_prereq
Requires(postun): %insserv_prereq
Provides: klogd:/etc/init.d/syslog
Requires: /etc/init.d/network
Requires(post): %fillup_prereq
Requires: logrotate
Requires: syslog
Requires: sysvinit(network)
Summary: Syslog service files & scripts
Group: System/Daemons
BuildArch: noarch
@ -176,37 +170,35 @@ Authors:
mv sample-s390.conf sample.conf
%endif
# honor the increased LOG_BUF_LEN in kernel/printk.c
make %{?_smp_mflags} LOG_BUFFER_SIZE=-DLOG_BUFFER_SIZE=131072
make %{?_smp_mflags} BINDIR=%{_sbindir} LOG_BUFFER_SIZE=-DLOG_BUFFER_SIZE=131072
%install
mkdir -p $RPM_BUILD_ROOT/{sbin,etc}
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/etc
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man{5,8}
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT%{sysdsysunitdir}-generators
mkdir -p $RPM_BUILD_ROOT%{sysdsysunitdir}
mkdir -p -m 0755 $RPM_BUILD_ROOT/var/run/rsyslog
mkdir -p -m 0755 $RPM_BUILD_ROOT/var/run/syslog-ng
make install MANDIR=%{_mandir} DESTDIR=$RPM_BUILD_ROOT
ln -sf ../etc/init.d/syslog $RPM_BUILD_ROOT/sbin/rcsyslog
mkdir -p -m 0755 $RPM_BUILD_ROOT/var/run/syslogd
make install MANDIR=%{_mandir} BINDIR=%{_sbindir} DESTDIR=$RPM_BUILD_ROOT
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/syslog
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 754 %{SOURCE5} $RPM_BUILD_ROOT/etc/init.d/syslog
install -m 754 %{SOURCE6} $RPM_BUILD_ROOT/etc/init.d/earlysyslog
install -d $RPM_BUILD_ROOT/%{omc_svcdir}/
install -m 600 %{SOURCE7} $RPM_BUILD_ROOT/%{omc_svcdir}/
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_mandir}/man8/syslog.8
install -m 755 %{SOURCE9} $RPM_BUILD_ROOT%{sysdsysunitdir}-generators/
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{sysdsysunitdir}/
ln -sf /dev/null $RPM_BUILD_ROOT%{sysdsysunitdir}/earlysyslog.service
install -m 600 %{SOURCE4} $RPM_BUILD_ROOT/%{omc_svcdir}/
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_mandir}/man8/syslog.8
install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 755 %{SOURCE9} $RPM_BUILD_ROOT/%{_sbindir}/
install -m 755 %{SOURCE10} $RPM_BUILD_ROOT/sbin/rcsyslog
for sbin in klogd syslogd ; do
ln -sf %{_sbindir}/${sbin} $RPM_BUILD_ROOT/sbin/${sbin}
done
%ifarch s390 s390x
sed 's/^KERNEL_LOGLEVEL=1/KERNEL_LOGLEVEL=7/' %{SOURCE2} \
> $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.syslog
sed -i 's/^KERNEL_LOGLEVEL=1/KERNEL_LOGLEVEL=7/' \
$RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.klogd
%endif
%if %{defined verify_permissions}
@ -214,28 +206,17 @@ mv sample-s390.conf sample.conf
%verify_permissions -e /etc/syslog.conf
%endif
%pre
%service_add_pre syslogd.service
%post
%set_permissions /etc/syslog.conf
#
# add syslog variables provided by syslogd if needed
#
%{fillup_only -ns syslog syslog}
#
# check if daemon configured in SYSLOG_DAEMON is
# installed and switch to ourself if it's missed
#
source etc/sysconfig/syslog
replace_syslog=no
if test "$SYSLOG_DAEMON" != "syslogd" ; then
if test -z "$SYSLOG_DAEMON" || \
test ! -x sbin/${SYSLOG_DAEMON} ; then
replace_syslog=yes
fi
fi
if test "$replace_syslog" == "yes" ; then
sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON="syslogd"/g' \
etc/sysconfig/syslog
fi
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%{fillup_only -ns syslog syslogd}
#
# create dirs, touch log default files
#
@ -254,60 +235,41 @@ touch var/log/news/news.err; chmod 640 var/log/news/news.err
chown news:news var/log/news/news.err
touch var/log/news/news.notice; chmod 640 var/log/news/news.notice
chown news:news var/log/news/news.notice
#
# Enable the syslogd as service
#
%service_add_post syslogd.service
%preun
%service_del_preun syslogd.service
%postun
if test -x /etc/init.d/syslog ; then
%restart_on_update syslog
fi
%{insserv_cleanup}
# reset SYSLOG_DAEMON variable
if test -f etc/sysconfig/syslog ; then
source etc/sysconfig/syslog
if test "$SYSLOG_DAEMON" == "syslogd" ; then
sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON=""/g' \
etc/sysconfig/syslog
fi
fi
%service_del_postun syslogd.service
%post -n syslog-service
#
# add syslog variables provided by klogd if needed
#
%{fillup_and_insserv -ny syslog syslog}
%{fillup_and_insserv -nY syslog earlysyslog}
mkdir -p -m 0755 var/run/rsyslog
mkdir -p -m 0755 var/run/syslog-ng
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%preun -n syslog-service
if test -x /etc/init.d/syslog ; then
%stop_on_removal syslog
fi
%postun -n syslog-service
if test -x /etc/init.d/syslog ; then
%restart_on_update syslog
fi
%{insserv_cleanup}
%pre -n klogd
%service_add_pre klogd.service
%post -n klogd
#
# add syslog variables provided by klogd if needed
#
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%{fillup_only -ns syslog klogd}
if test -x /etc/init.d/syslog ; then
%restart_on_update syslog
fi
#
# Enable the syslogd as service
#
%service_add_post klogd.service
%preun -n klogd
if test -x /etc/init.d/syslog ; then
%restart_on_update syslog
fi
%service_del_preun klogd.service
%postun -n klogd
if test -x /etc/init.d/syslog ; then
%restart_on_update syslog
fi
%{insserv_cleanup}
%service_del_postun klogd.service
%files
%defattr(-,root,root)
@ -316,6 +278,10 @@ fi
%doc %{_mandir}/man5/syslog.conf.5.gz
%doc %{_mandir}/man8/syslogd.8.gz
%doc %{_mandir}/man8/sysklogd.8.gz
%config %{sysdsysunitdir}/syslogd.service
%{_sbindir}/syslogd-service-prepare
%attr(0755,root,root) %dir %ghost /var/run/syslogd
/usr/sbin/syslogd
/sbin/syslogd
%files -n klogd
@ -323,22 +289,15 @@ fi
/var/adm/fillup-templates/sysconfig.klogd
%config %{sysdsysunitdir}/klogd.service
%doc %{_mandir}/man8/klogd.8.gz
/usr/sbin/klogd
/sbin/klogd
%files -n syslog-service
%defattr(-,root,root)
/var/adm/fillup-templates/sysconfig.syslog
%config(noreplace) /etc/logrotate.d/syslog
%config /etc/init.d/syslog
%config /etc/init.d/earlysyslog
%config %{sysdsysunitdir}/earlysyslog.service
%config %{sysdsysunitdir}/syslog.service
%config %{sysdsysunitdir}/klog.service
%doc %{_mandir}/man8/syslog.8.gz
/sbin/rcsyslog
%attr(0744,root,root) %{sysdsysunitdir}-generators/syslog-service-generator
%attr(0755,root,root) %dir %ghost /var/run/rsyslog
%attr(0755,root,root) %dir %ghost /var/run/syslog-ng
%{omc_svcdir}/syslog.xml
/sbin/rcsyslog
%changelog