Skip to content

Add support for prerotate script #22

Open
@danrough

Description

@danrough

Proposed feature

Add ability for a user of this role to define a prerotate script that is run prior to the logrotation process.

Rationale

In the same way that logrotate provides the ability to run a script after a log has been rotated, it also provides a means by which a script can be run in advance. This functionality is used in my case to push log files off to an s3 bucket before rotation occurs.

Additional context

prerotate is define in the manpage, here https://linux.die.net/man/8/logrotate

prerotate/endscript
The lines between prerotate and endscript (both of which must appear on lines by themselves) are executed (using /bin/sh) before the log file is rotated and only if the log will actually be rotated. These directives may only appear inside a log file definition. Normally, the absolute path to the log file is passed as first argument to the script. If sharedscripts is specified, whole pattern is passed to the script. See also postrotate. See sharedscripts and nosharedscripts for error handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions