Pyslog syslog logger cannot write more than 2048 characters

I am trying to print some messages in syslog using the Pyslog syslog logger. A simple logger as described in How to set up logging for syslog in python? ":

import logging import logging.handlers my_logger = logging.getLogger('MyLogger') my_logger.setLevel(logging.DEBUG) handler = logging.handlers.SysLogHandler() my_logger.addHandler(handler) my_logger.debug('this is debug') 

But when I try to print a very long message like my_logger.debug('<<4000 chars>>') , it only prints the first 2046 characters. Is there such a known limit in Python?

From what I could compile, Python supports very large string input and all arguments are passed as a reference, so there should be no problem handling such large input. Any thoughts?

+4
source share
2 answers

rsyslogd defaults to 2048 bytes per message, but you can set it using the $MaxMessageSize parameter in /etc/rsyslog.conf :

$ MaxMessageSize, default 2k - allows you to specify the maximum supported message size (both for sending and receiving).

Link: http://www.rsyslog.com/doc/v8-stable/configuration/global/index.html

+2
source

You must use GELF http://www.graylog2.org/about/gelf

Graylog’s extended log format (GELF) avoids the disadvantages of the classic simple syslog:

 Limited to length of 1024 byte - Not much space for payloads like backtraces Unstructured. You can only build a long message string and define priority, severity etc. 

You can learn more from this. Is there a 1K limit in Syslog?

0
source

All Articles