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

feat: Add options for rate limit interval and burst #64

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ unless otherwise indicated.
received by the journal daemon shall be forwarded to a traditional syslog
daemon. Defaults to `false`.

- `journald_rate_limit_interval_sec` - integer variable, in seconds, configures the
time interval within which only `journald_rate_limit_burst` messages are handled.
See `man 5 journald.conf` for more information.

- `journald_rate_limit_burst` - integer variable, sets the upper limit of messages
from a service which are handled within the time defined by
`journald_rate_limit_interval_sec`.
See `man 5 journald.conf` for more information.

## Example Playbook

```yaml
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ journald_per_user: false
journald_compression: true
journald_sync_interval: 0
journald_forward_to_syslog: false
journald_rate_limit_interval_sec: 30
journald_rate_limit_burst: 10000
2 changes: 2 additions & 0 deletions templates/journald.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ RuntimeMaxFileSize={{ journald_max_file_size }}M
{# settings below here apply to all storage types #}
Compress={{ journald_compression | bool | ternary("yes", "no") }}
ForwardToSyslog={{ journald_forward_to_syslog | bool | ternary("yes", "no") }}
RateLimitIntervalSec={{ journald_rate_limit_interval_sec }}s
RateLimitBurst={{ journald_rate_limit_burst }}
14 changes: 14 additions & 0 deletions tests/tests_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
journald_per_user: true
journald_sync_interval: 1
journald_forward_to_syslog: true
journald_rate_limit_burst: 2000
journald_rate_limit_interval_sec: 2

tasks:
- name: Run test
Expand Down Expand Up @@ -39,6 +41,18 @@
"{{ __journald_dropin_dir }}/{{ __journald_dropin_conf }}"
changed_when: false

- name: Verify that rate limit interval is set properly
command: >-
grep RateLimitIntervalSec=2s
"{{ __journald_dropin_dir }}/{{ __journald_dropin_conf }}"
changed_when: false

- name: Verify that rate limit burst is set properly
command: >-
grep RateLimitBurst=2000
"{{ __journald_dropin_dir }}/{{ __journald_dropin_conf }}"
changed_when: false

- name: Verify that /var/log/journal/$MACHINE_ID/system.journal exists
stat:
path: /var/log/journal/{{ ansible_machine_id }}/system.journal
Expand Down
Loading