[syslog-ng] Use specific python3 binary file
Armando Martires
amartires at smartechnologies.pt
Thu Oct 24 17:00:44 UTC 2019
Hi,
I set up my destination in syslog-ng config file as follows:
destination d_syslog2snmp {
program("/apps/syslog-ng/syslog2snmp.py"
template("<${PRI}>${DATE} ${HOST} ${MESSAGE}\n"));
};
My Script is like this:
#!/usr/bin/python3
while True:
msg = input()
f = open("/tmp/pysnmp.out","a+")
f.write(f"{ line }")
f.close()
But I'm getting this in loop on my log file:
Oct 24 17:56:37 lab-srv-slg-v01 syslog-ng[9934]: Child program
exited, restarting; cmdline='/apps/syslog-ng/syslog2snmp.py', status='32256'
I also tried to use a bash script exactly as the manual gives as an
example but I get the same kind of error loop.
Does any one have a clue on how to solve this?
Regards,
Armando Martires
On 10/23/2019 4:51 PM, László Várady (lvarady) wrote:
> Hi,
>
> > How can I configure syslog-ng to use this alternative binary file?
>
> If you are using the Python destination (not the program() destination
> executing the python3 binary), then syslog-ng does not use the Python
> binary at all.
>
> The python() destination starts a separate thread inside syslog-ng
> instead, and uses the libpython library to interpret Python code.
>
> In case you have syslog-ng compiled with Python 3 support, you can
> specify which libpython to use with the LD_LIBRARY_PATH environment
> variable or with standard ldconfig configurations.
> For example: /apps/lib/libpython3.so --> LD_LIBRARY_PATH=/apps/lib
>
> A syslog-ng instance compiled with Python 2 support currently can't be
> configured to use Python 3, you have to recompile it from source in
> this case (./configure --enable-python --with-python=3, for example).
> The PKG_CONFIG_PATH envvar can be used to help the configure script
> find the appropriate path to libpython.
>
>
> --
> László Várady
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20191024/8e6d0caa/attachment.html>
More information about the syslog-ng
mailing list