[syslog-ng] Error loading Python module for log destination

Wil Koch wfkoch at gmail.com
Mon Feb 29 21:54:54 CET 2016


In case anyone else comes across this issue, I had to add PYTHONPATH to the
suders file, see here for more details,
http://stackoverflow.com/questions/25387374/why-are-modules-in-pythonpath-not-found-when-the-containing-directory-is-part-of

Also the documentation at
https://syslog-ng.gitbooks.io/getting-started/content/chapters/chapter_5/section_1.html
is old and doesn't reflect the current method signatures, in particular the
init function now requires 2 arguments, this is shown in the example source
https://github.com/balabit/syslog-ng/blob/master/modules/python/sngexample.py

Cheers,
Wil

On Sat, Feb 27, 2016 at 7:21 PM Scheidler, Balázs <
balazs.scheidler at balabit.com> wrote:

> Hmm. Maybe an exception  happens during import? Clearly the import itself
> fails.
> On Feb 26, 2016 20:24, "Wil Koch" <wfkoch at gmail.com> wrote:
>
>> Hi All,
>> I am following the tutorial below in an attempt to get Python support for
>> destinations,
>>
>>
>> https://syslog-ng.gitbooks.io/getting-started/content/chapters/chapter_5/section_1.html
>>
>> I have built syslog-ng-3.7.2 from source and have it up and running on
>> Ubuntu 14.04. I initially had a simple log for iptables logging to a file
>> to confirm functionality. After I  changed my conf to include a Python
>> destination, I am receiving the following error when starting syslog-ng at
>> the command line,
>>  [2016-02-26T12:15:48.874748] Error loading Python module;
>> module='betterpythonexample', exception='exceptions.ImportError: No module
>> named betterpythonexample'
>> [2016-02-26T12:15:48.874775] Error looking Python driver class;
>> driver='python_to_file#0', class='betterpythonexample.TextDestination',
>> exception='None'
>> [2016-02-26T12:15:48.874782] Error initializing message pipeline;
>>
>> I have PYTHONPATH set to the directory where the script is, and I have
>> confirmed the variable is working by importing the module in the python
>> interpreter. Any suggestions for debugging would be much appreciated, I'm
>> out of ideas.
>>
>> Thank you,
>> Wil
>>
>>
>> ______________________________________________________________________________
>> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> Documentation:
>> http://www.balabit.com/support/documentation/?product=syslog-ng
>> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>>
>>
>>
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation:
> http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20160229/dc60ef00/attachment.htm 


More information about the syslog-ng mailing list