Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible implication of increasing the MaxMessageSize to 64K #5137

Closed
meetme2meat opened this issue May 15, 2023 · 14 comments
Closed

possible implication of increasing the MaxMessageSize to 64K #5137

meetme2meat opened this issue May 15, 2023 · 14 comments

Comments

@meetme2meat
Copy link

We found today that our application logs are getting truncated on writing to rsyslog file upon reading the rsyslog documentation I understood that the default limit is 8K. Given we are hitting this limit we are possibly thinking of increasing the MaxMessageSize to 32 - 64K but the documentation highlights that it can cause some memory footprint.

https://www.rsyslog.com/doc/master/configuration/global/index.html

Well I just wanted to confirm whether it is safe to have that number for the MaxMessageSize

Environment.

  • rsyslog version: rsyslogd: version 8.1901.0
  • platform: Linux Debian 64 bit Intel.
@meetme2meat meetme2meat changed the title possible implication of increase the MaxMessageSize to 64K possible implication of increasing the MaxMessageSize to 64K May 15, 2023
@davidelang
Copy link
Contributor

davidelang commented May 15, 2023 via email

@meetme2meat
Copy link
Author

thanks @davidelang I guess 64k would be enough for us we have 8GB Ram. But I wonder why does rsyslog still truncate

when I have set the $MaxMessageSize 64k in the rsyslog.conf file

#/etc/rsyslog.conf.d
#1.1
$MaxMessageSize 64k
module(load="imuxsock")
module(load="imklog")
module(load="imudp")
input(type="imudp" port="514")
#$KLogPermitNonKernelFacility on
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$RepeatedMsgReduction on
#$FileOwner syslog
#$FileGroup adm
#$FileCreateMode 0640
#$DirCreateMode 0755
#$Umask 0022
#$PrivDropToUser syslog
#$PrivDropToGroup syslog
$WorkDirectory /var/spool/rsyslog
$IncludeConfig /etc/rsyslog.d/*.conf

I still see the truncation in the final result.

@davidelang
Copy link
Contributor

davidelang commented May 15, 2023 via email

@rgerhards
Copy link
Member

rgerhards commented May 15, 2023 via email

@meetme2meat
Copy link
Author

meetme2meat commented May 15, 2023

@rgerhards I'm plainly writing the logs to stdout, even If I enabled Tcp for rsyslog how may I suppose (sent log over tcp) to ryslogd as I don't have a TCP client?

@meetme2meat
Copy link
Author

@rgerhards Ok so I just learned that systemd is the client here when I write to stdout and systemd forward the logs to rsyslog over the unix /dev/log still not sure how can I ask it to use TCP over unix and would unix not work?

@davidelang
Copy link
Contributor

davidelang commented May 15, 2023 via email

@meetme2meat
Copy link
Author

meetme2meat commented May 18, 2023

@davidelang @rgerhards is there a provision to split the message in smaller size? I see splitOversizeMessage but I'm not sure how is it used?

splitOversizeMessage(smsg_t *const pMsg)

@rgerhards
Copy link
Member

It only affects messages that get larger during rsyslog processing, not on the regular input side. Also, while it will split the message, the result will not be very satisfying. If journal has no option to process larger messages, and inject them properly into rsyslog, you need to bypass journal.

@meetme2meat
Copy link
Author

@rgerhards @davidelang I have a question

I just removed the following entry from the target.service file

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sbagent

and following rsyslog conf

$MaxMessageSize 64k
module(load="imuxsock")
module(load="imklog")
module(load="imudp")
input(type="imudp" port="514")
#$KLogPermitNonKernelFacility on
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$RepeatedMsgReduction on
#$FileOwner syslog
#$FileGroup adm
#$FileCreateMode 0640
#$DirCreateMode 0755
#$Umask 0022
#$PrivDropToUser syslog
#$PrivDropToGroup syslog
$WorkDirectory /var/spool/rsyslog
$IncludeConfig /etc/rsyslog.d/*.conf

Now I see the logs are getting split. A 1.5 MB log was split which is something I wanted, but to understand how that happened I'm writing this.

Thanks

@meetme2meat
Copy link
Author

@rgerhards @davidelang I understood who is splitting the message default stdout is written to the system journal by systemd. And journald conf has an entry LINE_MAX which split the large message greater than default 48K.

Now the only piece of the puzzle I would like to understand is when no imjournal module is enabled how come rsyslog is observing the journal message?

@davidelang
Copy link
Contributor

davidelang commented May 22, 2023 via email

@rgerhards
Copy link
Member

it looks like this is fully answered, so closing the issue.

@meetme2meat
Copy link
Author

meetme2meat commented Jun 7, 2023

@rgerhards, @davidelang Thanks for all the help, for future seekers. I have increased the MAX_MESSAGE_SIZE to 64K

and let the journald do the splitting see this #5137 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants