diff --git a/fail2ban/server/filtersystemd.py b/fail2ban/server/filtersystemd.py index be5a6dc4..c2a72598 100644 --- a/fail2ban/server/filtersystemd.py +++ b/fail2ban/server/filtersystemd.py @@ -91,7 +91,9 @@ class FilterSystemd(JournalFilter): # pragma: systemd no cover try: args['flags'] = int(kwargs.pop('journalflags')) except KeyError: - args['flags'] = 4 + # be sure all journal types will be opened if files specified (don't set flags): + if 'files' not in args or not len(args['files']): + args['flags'] = 4 return args diff --git a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py index b8e0e04a..46a0d0b5 100644 --- a/fail2ban/tests/filtertestcase.py +++ b/fail2ban/tests/filtertestcase.py @@ -1280,6 +1280,11 @@ def get_monitor_failures_journal_testcase(Filter_): # pragma: systemd no cover jrnlfile = self._getRuntimeJournal() self._initFilter(journalfiles=jrnlfile) + def testJournalFilesAndFlagsArgs(self): + # retrieve current system journal path + jrnlfile = self._getRuntimeJournal() + self._initFilter(journalfiles=jrnlfile, journalflags=0) + def testJournalPathArg(self): # retrieve current system journal path jrnlpath = self._getRuntimeJournal()