summaryrefslogtreecommitdiffstats
path: root/collectors/systemd-journal.plugin
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 04:35:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 04:35:07 +0000
commita14f1d0e7c54950d80236aba6c0e26217952d77f (patch)
treec19c1562f9ca0578e314dd9a35c766bb4d5e7607 /collectors/systemd-journal.plugin
parentReleasing debian version 1.43.1-1. (diff)
downloadnetdata-a14f1d0e7c54950d80236aba6c0e26217952d77f.tar.xz
netdata-a14f1d0e7c54950d80236aba6c0e26217952d77f.zip
Merging upstream version 1.43.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/collectors/systemd-journal.plugin/systemd-journal.c b/collectors/systemd-journal.plugin/systemd-journal.c
index c2bd98e7d..877371120 100644
--- a/collectors/systemd-journal.plugin/systemd-journal.c
+++ b/collectors/systemd-journal.plugin/systemd-journal.c
@@ -647,7 +647,7 @@ static bool netdata_systemd_filtering_by_journal(sd_journal *j, FACETS *facets,
size_t failures = 0;
size_t filters_added = 0;
- SD_JOURNAL_FOREACH_FIELD(j, field) {
+ SD_JOURNAL_FOREACH_FIELD(j, field) { // for each key
bool interesting;
if(fqs->data_only)
@@ -660,7 +660,7 @@ static bool netdata_systemd_filtering_by_journal(sd_journal *j, FACETS *facets,
bool added_this_key = false;
size_t added_values = 0;
- SD_JOURNAL_FOREACH_UNIQUE(j, data, data_length) {
+ SD_JOURNAL_FOREACH_UNIQUE(j, data, data_length) { // for each value of the key
const char *key, *value;
size_t key_length, value_length;
@@ -673,19 +673,24 @@ static bool netdata_systemd_filtering_by_journal(sd_journal *j, FACETS *facets,
continue;
if(added_keys && !added_this_key) {
- if(sd_journal_add_conjunction(j) < 0)
+ if(sd_journal_add_conjunction(j) < 0) // key AND key AND key
failures++;
added_this_key = true;
added_keys++;
}
else if(added_values)
- if(sd_journal_add_disjunction(j) < 0)
+ if(sd_journal_add_disjunction(j) < 0) // value OR value OR value
failures++;
if(sd_journal_add_match(j, data, data_length) < 0)
failures++;
+ if(!added_keys) {
+ added_keys++;
+ added_this_key = true;
+ }
+
added_values++;
filters_added++;
}