José Manuel added the comment:

Sorry to bother you again, but I've tested this not only with Fluentd, but with 
a RSYSLOG server and it does not work with TCP except if you manually add the 
trailer LF character. Other than that, UDP default transport protocol has no 
issues and works fine with both systems. Here's my simple code:

-------
sHandler = logging.handlers.SysLogHandler(address=(address[0], address[1]), 
socktype = socket.SOCK_STREAM)
sHandler.setFormatter(logging.Formatter(fmt=MSG_SYSLOG_FORMAT, 
datefmt=DATE_FMT))
self.addHandler(sHandler)
-------

After reading RFC 6587 I think the SyslogHandler class should implement at 
least one of the framing mechanisms proposed by this RFC, meant for TCP 
transmission:
- Octet counting
- Trailer character (e.g. LF)

Besides, I've being checking out the library "pyloggr" 
(https://github.com/stephane-martin/pyloggr) and they are implementing both 
mechanisms. As for SyslogHandler, it will be as simple as adding another field 
to the class constructor (use_delimiter?) and to add these lines to the emit 
code (it works):

-------
if (self.use_delimiter):
    msg = msg + '\n'
else:
    msg = str(len(msg)) + ' ' + msg # default behavior
-------

Thank you again

----------
status: closed -> pending

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28404>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to