<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p>Hi,</p>
<p><br>
</p>
<p>I set up my destination in syslog-ng config file as follows:</p>
<p><br>
</p>
<p> destination d_syslog2snmp {</p>
<p> program("/apps/syslog-ng/syslog2snmp.py"
template("<${PRI}>${DATE} ${HOST} ${MESSAGE}\n"));</p>
<p> };</p>
<p><br>
</p>
<p>My Script is like this:</p>
<p><br>
</p>
<p> #!/usr/bin/python3<br>
while True:</p>
<p> msg = input()<br>
f = open("/tmp/pysnmp.out","a+")<br>
f.write(f"{ line }")<br>
f.close()<br>
</p>
<p><br>
</p>
<p>But I'm getting this in loop on my log file:<br>
</p>
<p><br>
</p>
<p> Oct 24 17:56:37 lab-srv-slg-v01 syslog-ng[9934]: Child
program exited, restarting;
cmdline='/apps/syslog-ng/syslog2snmp.py', status='32256'</p>
<p><br>
</p>
<p>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.<br>
Does any one have a clue on how to solve this?<br>
<br>
Regards,<br>
Armando Martires<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 10/23/2019 4:51 PM, László Várady
(lvarady) wrote:<br>
</div>
<blockquote type="cite"
cite="mid:DM6PR19MB314896816347E6C7C6BF0253F76B0@DM6PR19MB3148.namprd19.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div>Hi,</div>
<div class="PlainText"><br>
> How can I configure syslog-ng to use this alternative
binary file?</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt">
<div class="PlainText"><br>
</div>
<div class="PlainText">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.</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">The python() destination starts a
separate thread inside syslog-ng instead, and uses the
libpython library to interpret Python code.</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">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.</div>
<div class="PlainText">For example: /apps/lib/libpython3.so
--> LD_LIBRARY_PATH=/apps/lib<br>
</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">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).</div>
<div class="PlainText">The PKG_CONFIG_PATH envvar can be
used to help the configure script find the appropriate
path to libpython.<br>
</div>
<div class="PlainText"><br>
</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">--</div>
<div class="PlainText">László Várady<br>
</div>
</span></font></div>
</blockquote>
</body>
</html>