[New-bugs-announce] [issue27373] logging.handlers.SysLogHandler with TCP not working on rsyslog5.8

吴冉波 report at bugs.python.org
Thu Jun 23 05:04:31 EDT 2016


New submission from 吴冉波:

logging.handlers.SysLogHandler with TCP not working on rsyslog5.8, but newer version rsyslog8.19 is fine.

I use SysLogHandler with TCP to send message to remote rsyslog server failed, but success with bash below: 

echo "<133>$0[$$]: Test syslog message from Netcat" | nc -w1 -t 192.168.1.23 514

this is my script: 
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import logging.handlers
import socket
import syslog

my_logger = logging.getLogger('MyLogger')  # logger is singleton
my_logger.setLevel(logging.DEBUG)

if __name__ == '__main__':

    handler = logging.handlers.SysLogHandler(address=('192.168.1.23', 514), facility="auth", socktype=socket.SOCK_STREAM)
    my_logger.addHandler(handler)
    my_logger.critical('this is critical')

    handler.flush()
    handler.close()
    my_logger.removeHandler(handler)

CentOS version is 6.6
Python version is 2.7.10

This is easy to repeat on my serval CentOS Server. And I attach tcpdump result of script and bash.

----------
components: Library (Lib)
files: fail.log
messages: 269112
nosy: vinay.sajip, 吴冉波
priority: normal
severity: normal
status: open
title: logging.handlers.SysLogHandler with TCP not working on rsyslog5.8
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file43518/fail.log

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27373>
_______________________________________


More information about the New-bugs-announce mailing list