From ab864148b96b69d16b329e267b309de272d2707f Mon Sep 17 00:00:00 2001 From: Radovan Sroka Date: Wed, 25 Oct 2017 13:29:25 +0200 Subject: [PATCH] Fixed imjournal module - imjournal didn't work at all - added imjournal patch for rhbz#1505853 --- rsyslog-8.30.0-imjournal-fix.patch | 77 ++++++++++++++++++++++++++++++ rsyslog.spec | 8 +++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 rsyslog-8.30.0-imjournal-fix.patch diff --git a/rsyslog-8.30.0-imjournal-fix.patch b/rsyslog-8.30.0-imjournal-fix.patch new file mode 100644 index 0000000..a786b8c --- /dev/null +++ b/rsyslog-8.30.0-imjournal-fix.patch @@ -0,0 +1,77 @@ +From 4736e53d471ac45024333588fcdf5bce5f8c61b8 Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Wed, 25 Oct 2017 11:09:40 +0200 +Subject: [PATCH] imjournal bugfix: module did not work at all + +The open function was broken by commit 92ac801 (v8.30.0), +resulting in no data being ever read from the journal. + +patch bases on the idea of Radovan Sroka given here: +https://github.com/rsyslog/rsyslog/issues/1895#issuecomment-339017357 +but follows the current imjournal-paradigm of having the journal +handle inside a global variable. + +see also https://github.com/rsyslog/rsyslog/issues/1895 +closes https://github.com/rsyslog/rsyslog/issues/1897 +--- + plugins/imjournal/imjournal.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c +index 8f043d5e1..2f1569837 100644 +--- a/plugins/imjournal/imjournal.c ++++ b/plugins/imjournal/imjournal.c +@@ -118,20 +118,20 @@ static sd_journal *j; + static rsRetVal persistJournalState(void); + static rsRetVal loadJournalState(void); + +-static rsRetVal openJournal(sd_journal* jj) { ++static rsRetVal openJournal(void) { + DEFiRet; + +- if (sd_journal_open(&jj, SD_JOURNAL_LOCAL_ONLY) < 0) ++ if (sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY) < 0) + iRet = RS_RET_IO_ERROR; + RETiRet; + } + +-static void closeJournal(sd_journal* jj) { ++static void closeJournal(void) { + + if (cs.stateFile) { /* can't persist without a state file */ + persistJournalState(); + } +- sd_journal_close(jj); ++ sd_journal_close(j); + } + + +@@ -513,10 +513,10 @@ pollJournal(void) + /* do not persist stateFile sd_journal_get_cursor will fail! */ + char* tmp = cs.stateFile; + cs.stateFile = NULL; +- closeJournal(j); ++ closeJournal(); + cs.stateFile = tmp; + +- iRet = openJournal(j); ++ iRet = openJournal(); + if (iRet != RS_RET_OK) { + char errStr[256]; + rs_strerror_r(errno, errStr, sizeof(errStr)); +@@ -773,13 +773,13 @@ ENDfreeCnf + /* open journal */ + BEGINwillRun + CODESTARTwillRun +- iRet = openJournal(j); ++ iRet = openJournal(); + ENDwillRun + + /* close journal */ + BEGINafterRun + CODESTARTafterRun +- closeJournal(j); ++ closeJournal(); + ratelimitDestruct(ratelimiter); + ENDafterRun + diff --git a/rsyslog.spec b/rsyslog.spec index 433d9ea..d04330b 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -16,7 +16,7 @@ Summary: Enhanced system logging and kernel message trapping daemon Name: rsyslog Version: 8.30.0 -Release: 1%{?dist} +Release: 2%{?dist} License: (GPLv3+ and ASL 2.0) Group: System Environment/Daemons URL: http://www.rsyslog.com/ @@ -57,6 +57,7 @@ Obsoletes: sysklogd < 1.5-11 Patch0: rsyslog-8.8.0-sd-service.patch Patch1: rsyslog-8.23.0-msg_c_nonoverwrite_merge.patch Patch2: rsyslog-8.30.0-imgssapi-compile-error.patch +Patch3: rsyslog-8.30.0-imjournal-fix.patch %package crypto Summary: Encryption support @@ -278,6 +279,7 @@ mv build doc %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 autoreconf -iv @@ -535,6 +537,10 @@ done %{_libdir}/rsyslog/omkafka.so %changelog +* Wed Oct 25 2017 Radovan Sroka - 8.30.0-2 +- imjournal didn't work at all +- added imjournal patch for rhbz#1505853 + * Mon Oct 23 2017 Radovan Sroka - 8.30.0-1 - rebase to 8.30.0 - added patch that resolves imgssapi compilation errors