2718 Commits

Author SHA1 Message Date
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
Rainer Gerhards
2387c248f3
testbench: change git access protocol to cover github change
github disabled anon access via git protocol, so we need to adjust
this to https

no functional change
2022-03-28 10:11:42 +02:00
Rainer Gerhards
b0435d5e89
Merge pull request #4791 from Cropi/dynamic-config-queue
Make the main message queue part of the config
2022-03-16 12:48:22 +01: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
alakatos
452b62b4a4 Make the main message queue part of the config 2022-03-01 09:56:39 +01:00
Michael Biebl
6569133c75
Typo fixes (#4801)
* typo fix: ambigious -> ambiguous

* typo fix: aquire -> acquire

* typo fix: assgined -> assigned

* typo fix: cancelation -> cancellation

* typo fix: childs -> children

* typo fix: configuraton -> configuration

* typo fix: delemiter -> delimiter

* typo fix: forwardig -> forwarding

* typo fix: initializiation -> initialization

* typo fix: intializing -> initializing

* typo fix: lengh -> length

* typo fix: mesage -> message

* typo fix: occured -> occurred

* typo fix: occurence -> occurrence

* typo fix: paramter -> parameter

* typo fix: remaing -> remaining

* typo fix: resetted -> reset

* typo fix: suppored -> supported

* typo fix: Sytem -> System

* typo fix: uncommited -> uncommitted

* typo fix: depricated -> deprecated

* typo fix: stoping -> stopping

* type fix: allow to -> allow one to
2022-02-17 10:54:12 +01:00
Masahiro Matsuya
46c79edc53 imfile: Remove inotify watch descriptor on inode change detected 2022-02-09 16:36:24 +09:00
Rainer Gerhards
f4a7733a96
Merge pull request #4762 from inahga/inahga-ompgsql-conninfo
ompgsql: allow connection params via connection string
2022-02-08 12:27: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
df166eaa1d
Merge pull request #4793 from rgerhards/i4770-tests
testbench: test cases for rscript comparisons
2022-02-04 15:56:00 +01:00
Rainer Gerhards
439b7ec0c0
Merge pull request #4786 from alorbach/pr-issue-4784
testbench: adapt contentcheck for tlscommands tests
2022-02-04 15:55:43 +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
504cc9fba3 omelasticsearch: Fix indexSuccess impstats counter in bulkmode
When bulkmode is enabled, and a batch was processed without any
failures (errors is false), the code that increments the indexSuccess
impstats counter was never reached. As fix, we obtain the numitems
first and add them to the indexSuccess impstats counter if
errors is false.

This fix may solve some of the random elasticsearch testbench failures.

closes: https://github.com/rsyslog/rsyslog/issues/4794
2022-02-03 15:57:56 +01:00
9428a9f666 testbench: adapt contentcheck for tlscommands tests
Under io / cpu stress, the OpenSSL tls error can be SSL_ERROR_SYSCALL
instead of SSL_ERROR_SSL. The outcome it the same from the
test perspective.

closes: https://github.com/rsyslog/rsyslog/issues/4784
2022-01-26 17:04:59 +01:00
Ameer Ghani
e98e691ad8
ompgsql: allow connection params via connection string
Happy new years! Add another action parameter `conninfo` that allows specifying
a postgres connection string. This enables us to use any of the postgres connection
parameters, particularly `sslmode` and `sslrootcert`.

Per the postgres docs, this connection string can be a URI or several key-value
pairs. https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING

Here's an example:
```
module(load="ompgsql")

action(
	type="ompgsql"
	conninfo="postgresql://postgres:password@localhost/Syslog?sslmode=require"
)
```

This addresses https://github.com/rsyslog/rsyslog/issues/4741 by allowing the
user to specify ssl options as part of the connection string. `libpq` will take
care of the rest.

This also addresses https://github.com/rsyslog/rsyslog/issues/4698 because
`libpq` is not constrained by MAXHOSTNAMELEN. Long hostnames will work.

`conninfo` can be specified in lieu of the other parameters. `ompgsql` will
prioritize using `conninfo` to connect over the other parameters.

Signed-off-by: Ameer Ghani <inahga@gmail.com>
2022-01-17 15:09:43 -06:00
87e3a90d29
testbench: adjust ElasticSearch startup parameters
Newer versions seem to require some new defaults. Maybe this also
helps with some hard-to-explain flakiness in ES test runs.
2022-01-17 15:51:10 +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
4fea318bcd
Merge pull request #4743 from Cropi/ratelimit-fix
Avoid use of loadConf in favor of runConf in ratelimiting during runtime
2021-12-14 13:25:12 +01:00
Rainer Gerhards
ba9c77c3f7
testbench: do not use valgrind --keep-debuginfo=yes by default
This option is not known by older valgrind versions. As such, it causes
false positives on older platforms. As the option is not necessary
(only helpful for some border cases), we remove it and add a comment
so that it may be enabled when necessary.
2021-12-13 10:01:25 +01:00
alakatos
ab99d68009 Use runConf instead of loadConf in ratelimiting during runtime 2021-12-08 19:36:48 +01:00
8fce4ad965 testbench: Add --keep-debuginfo=yes to default valgrind parameters.
This maintains a full stack trace, otherwise can be incomplete in some
cases!
2021-11-24 09:27:20 +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
2caf936bb5
testbench: modernize some tests
no functional changes
2021-11-18 08:44:28 +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
672901845d
mmanon: relax IPv6 detection - improve anonymization
We so far tried to ensure a value is really an IPv6 address, in order
to avoid to mangle with just similar-looking information elements.
However, this lead to misdetection for unusual formats, e.g. when a
port is appended to a numerical IPv6 adress given without braces [].
This has been changed now. In a sense, we now prefer to err on the
side of privacy.

BEHAVIOR CHANGE:
Previously, a suspect value was not anonymized, and thus some other
elements (like some MAC addresses) preserved. Now the opposite is
true, and we anonymize anything that looks close enough to be an
IPv6 address. This improves anonymization.

closes https://github.com/rsyslog/rsyslog/issues/4725
2021-11-17 17:12:03 +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
Michael Biebl
440fd1d51c testbench: skip omfwd_fast_imuxsock.sh if liblogging-stdlog is not available
Fixes #4712
2021-10-20 18:15:27 +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
Rainer Gerhards
7c3cf8e26e
Merge pull request #4685 from richm/fix-es-bulk-setting
Fix ElasticSearch Test broken by ES incompatibility
2021-09-24 12:44:17 +02:00
Rich Megginson
942f11b4d7
use correct api for es 6 and later
Special thanks to Radu Gheorghe for his help in adjusting ES 7
config so that test preconditions are still met.
2021-09-24 11:54:56 +02:00
Rainer Gerhards
d2d0254ab2
testbench: disable some clickhouse tests
It looks like the current version of clickhouse does not error out
on some types of errors. So tests need either to be redesigned
or removed.

As such, we temporarily skip them for now.
2021-09-21 13:05:14 +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
61ba7f222c testbench: fix kafka URL for downloading components
We now also host kafka downloads on our own infrastructure, so
that they do not "suddenly" disappear (happened in the past).
2021-09-21 10:49:22 +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
Rich Megginson
5f3bd43951
Fix ElasticSearch Test broken by ES incompatibility
https://github.com/rsyslog/rsyslog/issues/4684
According to https://discuss.elastic.co/t/unknown-setting-thread-pool-bulk-queue-size/180120
The setting `thread_pool.bulk` has been renamed to `thread_pool.write`
"The bulk threadpool was renamed to write in 6.3.0, and support for the legacy bulk name was removed in 7.0.0 133."
2021-09-16 14:15:03 +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
Rainer Gerhards
f30cc42ff1
testbench: bump kafka and zookeeper versions 2021-09-07 14:34:20 +02:00
Rainer Gerhards
9497a99119
Merge pull request #4662 from rgerhards/i4619
testbench: fix privdrop tests under root user
2021-09-07 09:45:39 +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