rsyslog/tests/omusrmsg_ratelimit_name.sh
Rainer Gerhards c8c3c11dd1
omusrmsg: add ratelimit support
Add ratelimit.interval, ratelimit.burst, and ratelimit.name parameters
to omusrmsg. This prevents DoS scenarios where emergency message floods
can overwhelm user terminals.

The implementation follows the established output module pattern:
- Sentinel-based (-1) defaults for mutual-exclusivity detection
- ratelimit.name references a shared ratelimit() configuration object
- Per-action ratelimiters via ratelimitNew()/ratelimitSetLinuxLike()
- ratelimitMsgCount() gate in doAction

Also adds module-level config (modConfData_s) with beginCnfLoad,
endCnfLoad, checkCnf, activateCnf, freeCnf entry points, needed to
stash rsconf_t* for ratelimitNewFromConfig().

Includes documentation updates and a config-validation test.

Closes: https://github.com/rsyslog/rsyslog/issues/4547

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 08:43:17 +01:00

18 lines
427 B
Bash
Executable File

#!/bin/bash
# Test for omusrmsg ratelimit.name support (config-validation test).
# added 2025-07-10 by RGerhards, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
ratelimit(name="omusrmsg_test_limit" interval="2" burst="5")
:msg, contains, "msgnum:" {
action(type="omusrmsg" users="nouser"
ratelimit.name="omusrmsg_test_limit")
}
'
startup
shutdown_when_empty
wait_shutdown
exit_test