Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 722 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 722 Bytes

Overview

Apache 2.0 License

This base layer provides a function to add logrotate support to any reactive charm.

Usage

Declarative via layer.yaml

options:
  logrotate:
    /var/log/foobar.log:
      - copytruncate
      - rotate 5
      - size 100k

In your charm code

from charms.layer import logrotate

@when(logrotate.installed, ...)
def setup_logrotate():
    logrotate_opts = {
        /var/log/foobar.log: [
            'copytruncate', 
            'rotate 5', 
            'size 100k', 
        ]
    }
    logrotate.configure(logrotate_opts)