Reputation: 111
I'm trying to print some messages to syslog using Python's syslog logger. Simple logger as described in "How to configure logging to 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'm trying to print a very long message like my_logger.debug('<<4000 chars>>')
, it is printing only first 2046 chars. Is there any such known limit in Python?
From what I could gather, Python supports a VERY big string input and all the arguments are passed as reference, so it should not be any problem in handling such large input. Any thoughts?
Upvotes: 4
Views: 4437
Reputation: 135
rsyslogd limits to 2048 bytes per message by default, but you can set it using $MaxMessageSize
parameter in /etc/rsyslog.conf
:
$MaxMessageSize , default 2k - allows to specify maximum supported message size (both for sending and receiving).
Reference: http://www.rsyslog.com/doc/v8-stable/configuration/global/index.html
Upvotes: 2
Reputation: 2897
You should use GELF http://www.graylog2.org/about/gelf
The Graylog Extended Log Format (GELF) avoids the shortcomings of classic plain 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 read more from this Does Syslog really have a 1KB message limit?
Upvotes: 0