Skip to content

Commit 96bd716

Browse files
dbhowellbruceg
authored andcommitted
Flush and reset any current filter before applying new filter (#1135)
As per systemd man: sd_journal_flush_matches() may be used to flush all matches, disjunction and conjunction terms again. After this call all filtering is removed and all entries in the journal will be iterated again. Signed-off-by: David Howell <[email protected]>
1 parent 8be060f commit 96bd716

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/journald/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ impl Journal {
159159

160160
// Journald does not guarantee that the following records are
161161
// only from the current boot, so a filter is also needed.
162+
self.lib.sd_journal_flush_matches(self.journal);
162163
let filter = format!("_BOOT_ID={}", boot_str);
163164
sd_result(self.lib.sd_journal_add_match(
164165
self.journal,
165166
filter.as_ptr() as *const c_void,
166167
filter.len(),
167168
))?;
168-
self.lib.sd_journal_flush_matches(self.journal);
169169

170170
Ok(())
171171
}

0 commit comments

Comments
 (0)