[MXS-655] Maxscale log rotation stymies logrotate Created: 2016-03-31  Updated: 2017-12-01  Resolved: 2016-07-04

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: 1.2.1
Fix Version/s: 2.1.0

Type: New Feature Priority: Major
Reporter: Benjamin Abbott-Scott Assignee: Johan Wikman
Resolution: Fixed Votes: 1
Labels: None


 Description   

Rotating maxscale logs via SIGUSR1, or flush logs, picks a new "maxscaleN.log" filename to begin writing to. This scheme violates assumptions that logrotate uses to count the number of logs retained, when using maxscale's documented logrotate configuration example.

Logrotate assumes that the filename will not change upon rotation - that the writing process will either reopen its logging filehandle at the original name, or will be restarted, effectively accomplishing the same thing.

Maxscale is using some internal logfile generation number, creating a new filename. When logrotate encounters this new name (with no apparent previous rotations), it determines that this is a new file with no rotations. This leads to old rotations never being removed.

Best practice would be to change the USR1 handling to simply reopen the logging file handle. This allows the external actor (logrotate) to move the file to a new name, and signal the maxscale service to reopen the original file location when appropriate.



 Comments   
Comment by Johan Wikman [ 2016-07-04 ]

From 2.1 onwards, the MaxScale logging behaviour is fully compatible with logrotate. When the log is rotated/flushed, MaxScale simply closes the file and repopens (and truncates) it using the same name.

Generated at Thu Feb 08 04:00:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.