diff --git a/README.md b/README.md index c411d81..4d98902 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 3675af2..74439d2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/templates/journald.conf.j2 b/templates/journald.conf.j2 index dd18c45..0f97433 100644 --- a/templates/journald.conf.j2 +++ b/templates/journald.conf.j2 @@ -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 }} diff --git a/tests/tests_example.yml b/tests/tests_example.yml index 0756655..04add0e 100644 --- a/tests/tests_example.yml +++ b/tests/tests_example.yml @@ -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 @@ -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