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

Add support for prerotate script #22

Open
danrough opened this issue May 23, 2024 · 0 comments
Open

Add support for prerotate script #22

danrough opened this issue May 23, 2024 · 0 comments

Comments

@danrough
Copy link

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.

danrough added a commit to danrough/ansible-role-logrotate that referenced this issue May 23, 2024
danrough added a commit to danrough/ansible-role-logrotate that referenced this issue May 26, 2024
danrough added a commit to danrough/ansible-role-logrotate that referenced this issue May 26, 2024
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

1 participant