This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author 吴冉波
Recipients vinay.sajip, 吴冉波
Date 2016-06-23.09:04:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466672671.84.0.9141309622.issue27373@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-06-23 09:04:31吴冉波setrecipients: + 吴冉波, vinay.sajip
2016-06-23 09:04:31吴冉波setmessageid: <1466672671.84.0.9141309622.issue27373@psf.upfronthosting.co.za>
2016-06-23 09:04:31吴冉波linkissue27373 messages
2016-06-23 09:04:31吴冉波create