#565745 Syslog-Socket /dev/log in chroots

Package:
schroot
Source:
schroot
Description:
Execute commands in a chroot environment
Submitter:
Christoph Berg
Date:
2010-01-18 15:12:05 UTC
Severity:
wishlist
#565745#3
Date:
2010-01-18 14:29:17 UTC
From:
To:
Package: schroot
Version: 1.2.3-1
Severity: wishlist

Hi,

it would be nice if schroot set up an syslog socket in the chroot, at
least for rsyslog. Here's a coarse script that works for me:


#!/bin/sh

set -e

if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
    . "$CHROOT_SCRIPT_CONFIG"
elif [ "$2" = "ok" ]; then
    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
    exit 1
fi

if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
    echo "\$AddUnixListenSocket ${CHROOT_PATH}/dev/log" > /etc/rsyslog.d/schroot.conf
    /etc/init.d/rsyslog reload
fi

if [ $1 = "setup-stop" ] ; then
    rm -f /etc/rsyslog.d/schroot.conf
    /etc/init.d/rsyslog reload
fi


Christoph

#565745#8
Date:
2010-01-18 14:41:09 UTC
From:
To:
This does look really neat.  I'm a little apprehensive about
modifying /etc during normal system operation though; does
rsyslog allow addition of sockets at runtime via another
interface, or placement of the files under /var?


Regards,
Roger

#565745#11
Date:
2010-01-18 15:07:31 UTC
From:
To:
Re: Roger Leigh 2010-01-18 <20100118144108.GF3781@codelibre.net>

/etc/rsyslog.conf:
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

I guess /etc/rsyslog.d/schroot.conf should just read

$IncludeConfig /var/lib/schroot/rsyslogd-interface.d/*.conf

which then could contain $UUID.conf files, or similar.

Btw, about robustness, rsyslogd doesn't mind if the socket directory
disappears or something. I did some stress-testing when adding a
socket for postfix in /etc/rsyslog.d/postfix.conf, and it wouldn't
break even if postfix was uninstalled. (Not so sure about the conf
directory.)

Christoph