An easy way to redirect all stdout/stderr of a given process to syslog is to do the following in a bash script:

exec 1> >(logger -t MYTAG) 2>&1

Please note this only works with bash as this is a bash extension to the POSIX standard.

If you want only stderr:

exec 2> >(logger -t MYTAG)

So if you have an application that runs on the foreground (and a properly written service should not daemonize in my opinion), you can have the following shell script for a quick solution:

exec 1> >(logger -t YADIYADA) 2>&1

I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.

Leave a Reply

Your email address will not be published. Required fields are marked *