Logrotate Charmers Logrotate Charm

  • By Logrotate Charmers
juju deploy logrotate-charmers-logrotate-charm
Show information
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.
Channel Version Revision Published Runs on
latest/stable 5 5 19 Mar 2021
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04


16.04 18.04 20.04


Logrotate configuration editor Read more

Relevant links

Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion


The logrotated charm will no longer be maintained by logrotate-charmers. If you have this charm installed without a publisher (i.e. "cs:logrotated") you do not need to do anything. The charm will automatically update to the new maintainer. If you are referencing "~logrotate-charmers/logrotate-charm" you will need to update to the new maintainer: "~llama-charmers/logrotated" (https://jaas.ai/u/llama-charmers/logroated)


logrotate is a subordinate charm that ensure that all logrotate.d configurations within /etc/logrotate.d/ folder are modified accordingly to a retention period defined in the charm


cd charm-logrotate                                                                  
charm build


Add to an existing application using juju-info relation.


juju deploy ubuntu
juju deploy ./charm-logrotate
juju add-unit ubuntu
juju add-relation ubuntu logrotate


The user can configure the following parameters:

  • logrotate-retention (default: 180): The logrotate retention period in days. The charm will go through ALL logrotate entries in /etc/logrotate.d/ and set the rotate config to the appropriate value, depending on the rotation interval used. For example if rotation is monthy and retention is 180 days -> rotate 6 or rotation is daily and retention is 90 days -> rotate 90 or rotation is weekly and retention is 21 days -> rotate 3 Weekly will round up the week count, for example if retention is set to 180 days -> rotate 26 (26 weeks x 7 days = 182 days) Yearly will put rotate to 1 and increase it with 1 for each 360 days. Monthly will round up, using 30 days for a month. Yearly will round up, adding a year for each 360 days.

  • override: (default: []): JSON formatted field containing a list of files that need to have custom logrotate interval and count. The format is as follows: [ {"path": "/etc/logrotate.d/rotatefile", "rotate": 5, "interval": "weekly"}, {}, ... ]

Mind the double quotes for the properties/values!

Valid options for rotate: any integer value
Valid options for interval: 'daily', 'weekly', 'monthly', 'yearly'


Unit tests have been developed to test return values from the charm helper class, while modifying pre-defined string entries with the logrotate syntax.

To run unit tests:

tox -e unit

Functional tests have been developed using python-libjuju, deploying a simple ubuntu charm and adding logortate as a subordinate.

To run tests using python-libjuju:

tox -e functional

Contact Information

Diko Parvanov diko.parvanov@canonical.com