1069 Commits

Author SHA1 Message Date
Rainer Gerhards
b564a13451
testbench bugfix: some valgrind tests were run when valgrind disabled
This leads to test failures e.g. with LLVM sanitizers.
2022-05-09 13:06:59 +02:00
Rainer Gerhards
30ccf7cd4c
testbench: new tests for potential buffer overrun 2022-04-25 10:25:17 +02:00
Rainer Gerhards
88c67d80e4
Merge pull request #4822 from sarroutbi/maxfilesize_non_empty_errorfile
Ensure error file does not increase appropriately when action.errorfile.maxsize option is enabled
2022-04-18 11:02:38 +02:00
Rainer Gerhards
6c16d84237
Merge pull request #4758 from mbarbon/mbarbon/format-iso-week
add property options to support ISO week/year number
2022-04-01 12:57:31 +02:00
Sergio Arroutbi
5734b5853a Ensure errorfile max. size correct handling
When action.errorfile.maxsize configuration
option is enabled and error file already has a
certain size smaller than max size configured,
it is increasing higher than configured max
size as the error file is considered
to be zero in code.
This fix reads current error file size and
limits the size to the maximum size configured

fixes #4821

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
2022-04-01 11:17:46 +02:00
Rainer Gerhards
71b81626ef
testbench: add tests for rscript comparison operations 2022-03-31 10:16:27 +02:00
Sergio Arroutbi
f64ef442d5 Add option to limit error file to configured size
action.errorfile.maxsize has been added to enable
option to limit the amount of bytes dumped to
configured errorfile

fixes #4733

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
2022-03-03 14:13:25 +01:00
Rainer Gerhards
94b467b3ee
Merge pull request #4690 from rgerhards/es7-test
testbench: restore original order of ES test execution
2022-02-04 17:54:33 +01:00
Rainer Gerhards
1a403f987b
testbench: restore original order of ES test execution
The order of execution was changed to a less optimal (more startups,
thus slower) order to work-around a testbench issue. This has been
fixed and so we can restore the original order.
2022-02-04 16:18:22 +01:00
Rainer Gerhards
7836d298b5
testbench: test cases for rscript comparisons
This covers failure cases from practice which were not yet covered.

see also: https://github.com/rsyslog/rsyslog/issues/4770
2022-02-04 14:57:17 +01:00
d0b88c748c omhttp: Fix memory leak in lokirest batchmode
A JSON object was created (valueObj) but not used and also not
released causing a memory leak. This was properly caused by the
initial copy&paste from serializeBatchKafkaRest.

- Also added a valgrind test for lokirest batchmode
  Uncomment "--keep-debuginfo" in testcaseif stack traces
  are incomplete

closes: https://github.com/rsyslog/rsyslog/issues/4766
2022-01-05 22:03:00 +01:00
Mattia Barbon
a11ad1a451 add property options to support ISO week/year number 2021-12-28 10:35:59 +01:00
Rainer Gerhards
03aa23a038
Merge pull request #4728 from VultureProject/faup_upstream
NEW CONTRIB::FFAUP:: URL parser module function using libfaup
2021-11-22 09:03:44 +01:00
frikilax
aeaf1160ed NEW CONTRIB::FFAUP:: URL parser module function using libfaup 2021-11-19 09:26:34 +01:00
Rainer Gerhards
03518837e5
testbench: add test for mmanon with IPv6 followed by port number
see also https://github.com/rsyslog/rsyslog/issues/4725
2021-11-17 17:13:37 +01:00
Rainer Gerhards
4b49b94405
testbench: false positive when impstats was not built
Test omfwd_fast_imuxsock failed when impstats was not built. This
has been corrected, test is now only executed when impstats is
present.
2021-10-25 12:39:47 +02:00
Rainer Gerhards
202e10e24c
testbench: add test for legacy permittedPeer statement
This is required to ensure backwards compatibility when doing changes
to the networking subsystem. So far this was not covered by any test.
2021-10-25 09:18:44 +02:00
6b3bba9e02 PrivDropToUser: fix abortOnIDResolutionFail handling #2
For new configuration style, security.abortonidresolutionfail was
not checked in rainerscript.

see also: https://github.com/rsyslog/rsyslog/pull/4710
closes: https://github.com/rsyslog/rsyslog/issues/4642
2021-10-13 10:57:22 +02:00
Rainer Gerhards
7b7a538da3
Merge pull request #4710 from alorbach/pr-issue-4642
PrivDropToUser: fix abortOnIDResolutionFail handling
2021-10-13 09:22:01 +02:00
03fdbfda74 PrivDropToUser: fix abortOnIDResolutionFail handling
security.abortonidresolutionfail needs to be loaded glblProcessCnf,
otherwise the setting is ignored in doGetUID / doGetGID.

see also: https://github.com/rsyslog/rsyslog/issues/4642
see also: cbcaf2c7e5
2021-10-12 12:15:15 +02:00
Rainer Gerhards
4a63f8e962
rscript fix: ruleset called async when ruleset had queue.type="direct"
The call rscript statement is able to call a rule set either synchronously or
asynchronously. We did this, because practice showed that both modes
are needed. For various reasons we decided to make async
calls if the ruleset has a queue assigned and sync if not.

To know if a "queue is assigned" we just checked if queue parameters were
given. It was overlookeded the case of someone explicitly specifying a
"direct  queue", aka "no queue". As such, queue="direct" triggered async
calls. That in turn meant that when a write operation to a variable was
made inside that rule set, other rulesets could or could not see the
write. While if was often not seen, this was a data race where the
change could also be seen by the outside.

This is now fixed. No matter if queue.type="direct" is specified or
left out, the call will always by synchronous. Any values written to
variables will also be seen by the "outside world" in later processing
stages.

Note that this has some potential to BREAK EXISTING CONFIGURATIONS.
We deem this acceptable because:

1. this was racy at all, so unexpected behaviour could alwas occur
2. it is actually unlikely that someone used the triggering conditions
   in practice. But we can not outrule this, especially when the
   configuration was auto-generated.

Potential compatibility issues can be solved by defining a small
array-memory queue on the ruleset in question instead of specifying
direct type.

Again, we expect that almost all users will never experience any
problems. If you do, however, please let us know: we may add an
option to re-enable the bug.
2021-10-11 15:07:16 +02:00
Rainer Gerhards
ed512aa18a
Merge pull request #4692 from alorbach/pr-issue-4686
openssl: Correct gnutlsPriorityString (custom ciphers) behaviour
2021-10-11 15:00:24 +02:00
edc1b186c1 openssl: Correct gnutlsPriorityString (custom ciphers) behaviour
- Only apply default anon ciphers if gnutlsPriorityString is NULL and
  Authentication Mode is set to anon. Otherwise we do not set them
  as they overwrite custom Ciphers.
- Added two tests for custom cipher configuration (anon/certvalid mode).
- Add call for applyGnutlsPriorityString if gnutlsPriorityString changes.
- Merged openssl init code from Connect into osslInitSession

closes: https://github.com/rsyslog/rsyslog/issues/4686
2021-09-21 11:21:14 +02:00
Rainer Gerhards
6b790d8936
testbench bugfix: no pid file wait on elasticsearch startup
The testbench framework does not properly wait until ES has created
its pid file, which probably means it did basic initializiation.
This can cause test synchronization issues and ultimately failures.
2021-09-21 10:26:55 +02:00
Rainer Gerhards
26ee7dc527
testbench: migrate testbench run to ElasticSearch 7
ElasticSearch 7 is now the major version. Replacing old-style
ES with it by default.

also add basic test for ElasticSearch 7.14, to make sure we will
test ES 7 once we move up to next higher version.

Note: ES 5 is no longer beeing tested as it looks outphased.

see also: https://github.com/rsyslog/rsyslog/pull/4566
2021-09-14 09:59:12 +02:00
Nelson Yen
a8b8d6c1f9
imhttp updates - query parameter ingestion & basic auth support
- Basic Authentication support & tests
  * configured via imhttp option "basicAuthFile". This option should be configured
    to point to your htpasswd file generated via a standard htpasswd tool.
  tests:
  * imhttp-post-payload-basic-auth.sh
  * imhttp-post-payload-basic-auth-vg.sh

- Query parameter ingestion capability & tests
  use t `addmetadata` option to inject query parameters into
  metadata for imhttp input.

Signed-off-by: Nelson Yen <nyen@salesforce.com>
2021-09-10 08:38:20 -07:00
9a1f4c0f59 testbench: add testcase for queue discardSeverity (linkedlist)
Testcase omfwd_fast_imuxsock.sh uses imuxsock as input and checks
how the queue engine (linkedlist) handles discarded messages.

see also:
https://github.com/rsyslog/rsyslog/issues/4437

requires PR:
https://github.com/rsyslog/rsyslog/pull/4674
2021-09-09 11:29:54 +02:00
Petr Gajdůšek
d69420a6a1 ratelimit: fix rate limiting for already parsed messages
Rate limiting may not have worked if the considered message had already
been parsed (not having NEEDS_PARSING in msgFlags).

This affects also imuxsock in its default configuration
(useSpecialParser="true" and ratelimit.severity="1")

A test for imuxsock is included which requires
./configure --enable-liblogging-stdlog
2021-08-25 17:33:17 +02:00
Rainer Gerhards
6080121ab7
config: implement script-equavalent for $PrivDrop* statements
closes https://github.com/rsyslog/rsyslog/issues/891
2021-08-23 14:10:16 +02:00
Rainer Gerhards
0c9b169a64
Merge pull request #4612 from n2yen/dev2-percentile
Percentile module to track percentile metrics via impstats
2021-08-16 08:31:21 +02:00
Rainer Gerhards
0461bacd4f
Merge pull request #4626 from n2yen/dev-ignore-older
imfile add `ignoreolderthanoption`
2021-08-12 10:18:25 +02:00
Nelson Yen
db44a20a25
imfile add ignoreolderthanoption
Submit on behalf of the primary author @yanjunli76

instructs imfile not to ingest a file that has not been modified in the
specified number of seconds.
2021-08-11 08:11:55 -07:00
Rainer Gerhards
a25c01c3d2
Merge pull request #4633 from pearseimperva/pearse/fix-deleteStateOnFileDelete
Fixing the deleteStateOnFileDelete option
2021-08-09 18:52:42 +02:00
Rainer Gerhards
38856e6989
Merge pull request #4628 from rgerhards/ci-add-test
CI: add test for imtcp not correctly starting up
2021-08-09 09:29:34 +02:00
pearse
fca8e14d65 fixing the deleteStateOnFileDelete option 2021-08-06 22:25:27 +00:00
Rainer Gerhards
be22ec54ad
CI: add test for imtcp not correctly starting up and a Solaris fix
Test should have been added to commit 3d23c7ac8aea but was forgotten.

This test also showed an issue on Solaris, where NULL values cannot
be used in printf functions. This has also been addressed.

see also: https://github.com/rsyslog/rsyslog/pull/4627
2021-08-06 12:42:58 +02:00
Rainer Gerhards
39e81e133b
omfwd: add capability for action-specific TLS certificate settings
This permits to override the global definitions for TLS certificates
at the action() level.
2021-08-06 09:00:24 +02:00
Rainer Gerhards
13f5dfe2e2
imtcp: permit to use different certificate files per input/action 2021-08-04 10:23:24 +02:00
Rainer Gerhards
b78fdde38a
Merge pull request #4407 from alorbach/pr-issue-4406
testbench: Add testcase for librelp EINPROGRESS issue
2021-06-23 09:36:50 +02:00
Nelson Yen
91a2049877
percentile module to track percentile metrics via impstats
Brief overview:
TO configure tracking percentile metrics in rainerscript:
User would need to define:
  - which percentile to track, such as [p50, p99, etc.]
  - window size - note, this correlates directly with memory usage to
  track the percentiles.

To track a value, user would call built-in function `percentile_observe()` in their configurations to
record an integer value, and percentile metrics would be emitted every
impstats interval.
2021-06-23 00:14:39 -07:00
bda68f999d omhttp: Fix dynrestpath param in batch mode
When batchmode was used, the templates could not be used to
expand dynrestpath. We are now storing the restpath param
within the batch data if we are in batch mode.

- testbench: Added tests for omhttp dynrestpath param
  Testing setting the restpath by template - one with batch mode
  and one without batch mode
- When we are in batch mode, and the restpath value changes, the
  batch is submitted and reinitialized

closes: https://github.com/rsyslog/rsyslog/issues/4567
2021-06-16 11:43:08 +02:00
6e2a79376f testbench: Add testcase for librelp EINPROGRESS issue
closes: https://github.com/rsyslog/rsyslog/issues/4406
See also: https://github.com/rsyslog/librelp/issues/207
2021-06-16 09:40:29 +02:00
Rainer Gerhards
8d48ecf10a
imtcp: add more override config params to input() 2021-05-10 12:30:17 +02:00
Rainer Gerhards
a08591be5d
imtcp: add stream driver parameter to input() configuration
This permits to have different inputs use different stream drivers
and stream driver parameters.

closes https://github.com/rsyslog/rsyslog/issues/3727
2021-05-05 12:57:09 +02:00
Rainer Gerhards
39896ca622
config script: add re_match_i() and re_extract_i() functions
This provides case-insensitive regex functionality.

closes https://github.com/rsyslog/rsyslog/issues/4429
2021-04-21 12:23:46 +02:00
Nelson Yen
af8085fc83
Add built-in function get_property() to access property vars
Provides ability to evaluate a rsyslog variable using dynamically
evaluated parameters.
  1st param is the rsyslog param, 2nd param is a key, can be an array
  index or key string.

Useful for accessing json sub-objects, where a key
needs to be evaluated at runtime. Can be used to access arrays as well.

see tests for examples

remove unnecessary escape char
2021-04-15 11:52:15 -07:00
Rainer Gerhards
2381890467
Merge pull request #4551 from julthomas/dev/jth/fmunflatten
fmunflatten: rscript function to unflatten keys in a JSON object
2021-04-06 19:14:23 +02:00
Rainer Gerhards
14aabc691e
testbench: add check for proper config include file order
This commit adds a check that include files are processed in the
proper order.

It also slightly changes some text that seemed to cause the wrong
impression that include files were processed in the wrong order.
Right the contrary is the case, as config files are being put on
a stack before they are processed.

closes https://github.com/rsyslog/rsyslog/issues/4271
2021-03-29 10:24:53 +02:00
Julien Thomas
9b779a319e tests: add test case for rscript function unflatten
You may want to review some of these tests.

The "conflict" and "key truncated" test cases are checking for a debug
message (rsyslog debug), this may be overkill. Also some tests require
jq in $PATH, to get deterministic JSON output (sorted keys). If jq is
not found, the tests are skipped.
2021-03-28 13:10:02 +02:00
Rainer Gerhards
591e6b1f0f
omfwd: add stats counter for sent bytes
Thanks to John Chivian for suggesting this feature.
2021-02-15 10:54:09 +01:00