Failed syslog-ng job still reported as "start/running"

Asked by Lowell Alleman on 2012-04-25

I'm running multiple syslog-ng instances to capture remote syslog events. Each syslog-ng instance has it's own separate IP address and it's own config file and upstart job. (It seems like I could use a multiple instance upstart job, but I'm trying to keep it simple.)

I'm running into a timing issue where upstart is starting my syslog-ng process BEFORE all the proper network interfaces are are available, which is preventing syslog-ng from starting. (I run into the same issue with syntax errors in the syslog-ng config file. Upstart reports the job as running, but there's no PID.) Also, since the process dies, why doesn't it respawn?

I'm confused as to why upstart reports the job as "start/running" when the syslog-ng process started and exited because of run-time issues. I've read over the docs a couple of times now and can't figure out what I'm doing wrong.

$ status syslog-ng-cisco
syslog-ng-cisco start/running

I'm running Ubuntu 10.04.4 LTS (upstart 0.6.5-8). Here's my upstart job .conf file:

# syslog-ng - system logging daemon
#

description "Syslog-ng daemon (cisco)"
env NAME="cisco"
env RUNAS="syslog"

start on (local-filesystems and net-device-up IFACE=vlan428)
stop on runlevel [!2345]

console output

expect fork
respawn
respawn limit 10 5

pre-start script
    # Check for executable and make sure internal log file is writable
    test -x /usr/sbin/syslog-ng || { stop; exit 0; }
    touch "/var/log/syslog-ng.$NAME.log"
    chown "$RUNAS:adm" "/var/log/syslog-ng.$NAME.log"

    # Test config file syntax
    CFG="/etc/syslog-ng/$NAME.conf"
    TESTOUT=/tmp/syslog-ng-syntax-check.$NAME.$$.out

    if /usr/sbin/syslog-ng --syntax-only -f "$CFG" > "$TESTOUT" 2>&1
    then
        rm -f "$TESTOUT"
    else
        cat "$TESTOUT" >> /var/log/syslog-ng-issues.log
        rm -f "$TESTOUT"
        stop
    fi
end script

post-stop script
    rm -f "/var/run/syslog-ng-$NAME.pid"
end script

exec /usr/sbin/syslog-ng -u "$RUNAS" -f "/etc/syslog-ng/$NAME.conf" -p "/var/run/syslog-ng-$NAME.pid"

Question information

Language:
English Edit question
Status:
Expired
For:
upstart Edit question
Assignee:
No assignee Edit question
Last query:
2012-04-25
Last reply:
2012-05-10
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.