I had a similar problem recently with the java environment variable with systemd and starting syslog-ng to output to elasticsearch, which required modification of the
/usr/lib/systemd/system/syslog-ng.service file to contain the following:-
Environment=LD_LIBRARY_PATH=/usr/java/jre1.8.0_112/lib/amd64/server
Perhaps your python environment variables also need exporting to this file?
Damian Bell Infrastructure Engineer | Support | H Clarkson & Co Ltd |
Email: Damian.Bell@clarksons.com |
From: syslog-ng [mailto:syslog-ng-bounces@lists.balabit.hu]
On Behalf Of Clayton Dukes
Sent: 10 February 2017 21:32
To: Syslog-ng users' and developers' mailing list <syslog-ng@lists.balabit.hu>
Subject: [syslog-ng] Syslog-ng, centos7 and systemd seem to hate each other
…or at the very least, say bad things when the other is not looking :)
I did a bit of googling for this and found other people with similar issues, but could not find the fix.
This is on a cos7.0 box (not 7.2) running syslog-ng v3.9 (user did have v3.5 but I tried upgrading him to resolve this).
If I run syslog-ng -Fdve it works fine and sends everything to our python program destination
However, if I use the systemd script provided with syslog-ng, then I get nothing.
If I tell sng to just log to a file (no filters, etc.), then it works.
If I tell sng to just use the program dest (no filters, etc.) it does NOT work.
If I do a 'systemctl stop syslog-ng' and then just simply type 'syslog-ng' (no foreground, debug, etc. switches) from the command line, it works fine.
Rather confusing, but I can't see why the systemctl file is not working as it should.
Any ideas?
Other references:
https://wiki.archlinux.org/index.php/syslog-ng
https://bbs.archlinux.org/viewtopic.php?id=187057
http://serverfault.com/questions/760383/syslog-ng-working-as-foreground-process-but-not-as-daemon
-Clayton