[syslog-ng] Use specific python3 binary file
Armando Martires
amartires at smartechnologies.pt
Thu Oct 24 17:59:17 UTC 2019
I did some further testing and is I start syslog-ng manualy with:
/sbin/syslog-ng -F -p /var/run/syslogd.pid
If I start with:
systemctl start syslog-ng
it fails.
I'm running syslog-ng 3.24 on a Centos 7 linux machine.
Seems like it's related with systemd...
But i'm stuck here...
Thanks four your help.
Regards,
Armando Martires
On 10/24/2019 6:00 PM, Armando Martires wrote:
>
> 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/7e843c6b/attachment.html>
More information about the syslog-ng
mailing list