1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-05 15:57:05 +00:00

Allow hourly logrotate (#11939)

* Allow hourly logrotate

logrotate 3.8.5 supports hourly:

https://github.com/logrotate/logrotate/blob/main/ChangeLog.md#385---2013-06-10

* style

* add changelog fragment

* Update plugins/modules/logrotate.py

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

* adjust changelog

* Update changelogs/fragments/11939-logrotate-hourly.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
abma 2026-05-16 14:57:21 +02:00 committed by GitHub
parent 6c2dbdae59
commit f97ff78c20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- logrotate - allow hourly logrotate (https://github.com/ansible-collections/community.general/pull/11939).

View file

@ -54,8 +54,9 @@ options:
- How often to rotate the logs.
- If not specified when modifying an existing configuration, the existing value is preserved.
- When creating a new configuration, this option is only included if specified.
- Choice V(hourly) was added in community.general 13.0.0.
type: str
choices: [daily, weekly, monthly, yearly]
choices: [hourly, daily, weekly, monthly, yearly]
rotate_count:
description:
- Number of rotated log files to keep.
@ -567,7 +568,17 @@ class LogrotateConfig:
):
if not any(
keyword in line
for keyword in [" ", "\t", "daily", "weekly", "monthly", "yearly", "rotate", "compress"]
for keyword in [
" ",
"\t",
"hourly",
"daily",
"weekly",
"monthly",
"yearly",
"rotate",
"compress",
]
):
paths.append(line)
@ -885,7 +896,7 @@ def main() -> None:
paths=dict(type="list", elements="path"),
rotation_period=dict(
type="str",
choices=["daily", "weekly", "monthly", "yearly"],
choices=["hourly", "daily", "weekly", "monthly", "yearly"],
),
rotate_count=dict(type="int"),
compress=dict(type="bool"),