Direct output to syslog with upstart

With the changes in /dev/kmsg

Ubuntu 14.04, I'm not sure if you can directly pipe STDOUT / STDERR from an upstart script to syslog. Previously, the script would have looked like this:

script
  exec &> /dev/kmsg
  cd /var/www/app
  exec bin/puma -C config/puma.rb
end script

      

I found a pretty viable alternative in pipelines inside the exec line:

script
  cd /var/www/app
  exec bin/puma -C config/puma.rb | logger -t puma
end script

      

This gives the exact result I want, but it leaves an upstart with the wrong PID. Instead of the PID for the process I want (puma), it has the logger PID instead.

So far I've tried to change the call exec &>

to channel:

exec 2>&1 | logger
exec -| logger
exec |& logger

      

Is there a syntactic option I'm missing? Is there any other descriptor I can navigate to? Thank!

+3


source to share


1 answer


There is a tricky but working example of how to accomplish this on serverfault:



https://serverfault.com/questions/114052/logging-a-daemons-output-with-upstart

0


source







All Articles