diff options
author | Georg Müller <georgmueller@gmx.net> | 2020-02-20 19:19:41 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-03-26 14:32:29 +0100 |
commit | 02f826c31a60253f14b858b4fd31e1b3c363730e (patch) | |
tree | 97623c8e3a65f34fc2b90f7edd03440781ecc689 /src | |
parent | bf671f3c6e41edfea082d1481056afb52468055a (diff) | |
download | systemd-02f826c31a60253f14b858b4fd31e1b3c363730e.tar.gz |
journalctl: show duplicate entries if they are from the same file (#14898)
When having a service which intentionally outputs multiple equal lines,
all these messages might be inserted with the same timestamp.
journalctl has a mechanism to avoid duplicate lines, which might be in
different journal files.
This patch allows duplicate lines, if they are from the same file.
(cherry picked from commit b6849042d610da90d5821a03967d648d424f7864)
(cherry picked from commit 2867dfbf70a5d761f662fe4b7c81a67e19df008b)
(cherry picked from commit d25598854dd7f517db160b5e377d379e34e72f28)
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/sd-journal.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 96e3cf33db..a3da490b48 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -434,11 +434,12 @@ _public_ void sd_journal_flush_matches(sd_journal *j) { detach_location(j); } -_pure_ static int compare_with_location(JournalFile *f, Location *l) { +_pure_ static int compare_with_location(const JournalFile *f, const Location *l, const JournalFile *current_file) { int r; assert(f); assert(l); + assert(current_file); assert(f->location_type == LOCATION_SEEK); assert(IN_SET(l->type, LOCATION_DISCRETE, LOCATION_SEEK)); @@ -447,7 +448,8 @@ _pure_ static int compare_with_location(JournalFile *f, Location *l) { l->realtime_set && f->current_realtime == l->realtime && l->xor_hash_set && - f->current_xor_hash == l->xor_hash) + f->current_xor_hash == l->xor_hash && + f != current_file) return 0; if (l->seqnum_set && @@ -786,7 +788,7 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc if (j->current_location.type == LOCATION_DISCRETE) { int k; - k = compare_with_location(f, &j->current_location); + k = compare_with_location(f, &j->current_location, j->current_file); found = direction == DIRECTION_DOWN ? k > 0 : k < 0; } else |