<div dir="auto">Hi,<div dir="auto"><br></div><div dir="auto">The example Python code should be unindented, or you see a different error?</div><div dir="auto"><br></div><div dir="auto">Also, you can always import code in the python block.</div><div dir="auto"><br></div><div dir="auto">With destinations you can specify a path to a python file, so the python block is not needed. But with template functions I've figured the $(python) call would be too crowded if we were passing explicit filename parameters.</div><div dir="auto"><br></div><div dir="auto">But you can encapsulate the python code as well as a wrapper to the python code into a separate file.</div><div dir="auto"><br></div><div dir="auto">Foobar.conf:</div><div dir="auto"><br></div><div dir="auto">python {</div><div dir="auto"><br></div><div dir="auto">from foobar import foobar_template_function</div><div dir="auto"><br></div><div dir="auto">}</div><div dir="auto"><br></div><div dir="auto">template-function foobar "$(python foobar)"</div><div dir="auto"><br></div><div dir="auto">----------</div><div dir="auto"><br></div><div dir="auto">Then you can use:</div><div dir="auto"><br></div><div dir="auto">@include "Foobar.conf"</div><div dir="auto"><br></div><div dir="auto">...</div><div dir="auto">template("$(foobar)");</div><div dir="auto">...</div><div dir="auto"><br></div><div dir="auto">Unfortunately then template function declarations cant take parameters yet from the callsite, which may be a serious limitation in your use-case. But with a conceot above you can completely hide implementation details your actual config.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mar 20, 2017 03:53, "Jorge Pereira" <<a href="mailto:jpereiran@gmail.com">jpereiran@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Well, based on this[1] document. We should use the <i>python {}</i> statement. But, I would like to keep my python script externally in a separated file and do something like.<div><br></div><div>python filter_001 {</div><div>   /my/script/python001.py</div><div>}<br><div><br></div><div>log {</div><div>   ....</div><div>   filter(filter_001);</div><div>   ....</div><div>};</div><div><br></div><div>p.s: Btw, this sample <a href="https://www.balabit.com/documents/syslog-ng-ose-3.7-guides/en/syslog-ng-ose-guide-admin/html-single/index.html#example-python-template-functions" target="_blank">https://www.balabit.<wbr>com/documents/syslog-ng-ose-3.<wbr>7-guides/en/syslog-ng-ose-<wbr>guide-admin/html-single/index.<wbr>html#example-python-template-<wbr>functions</a> don't work in the syslog-ng 3.9.1</div><div><br></div><div>[1] <a href="https://www.balabit.com/sites/default/files/documents/syslog-ng-ose-3.7-guides/en/syslog-ng-ose-v3.7-guide-admin/html-single/index.html#example-python-template-functions" target="_blank">https://www.balabit.com/sites/<wbr>default/files/documents/syslog<wbr>-ng-ose-3.7-guides/en/syslog-<wbr>ng-ose-v3.7-guide-admin/html-<wbr>single/index.html#example-<wbr>python-template-functions</a><br clear="all"><div><div class="m_7508179016639834892gmail-m_-2478784884897075564gmail_signature"><div dir="ltr">--<div>Jorge Pereira</div></div></div></div>
</div></div></div>
<br>______________________________<wbr>______________________________<wbr>__________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/<wbr>mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" rel="noreferrer" target="_blank">http://www.balabit.com/<wbr>support/documentation/?<wbr>product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" rel="noreferrer" target="_blank">http://www.balabit.com/wiki/<wbr>syslog-ng-faq</a><br>
<br>
<br></blockquote></div></div>