Blame SOURCES/rsyslog-8.24.0-rhbz1088021-systemd-time-backwards.patch
|
|
b65758 |
diff -up ./plugins/imjournal/imjournal.c.time ./plugins/imjournal/imjournal.c
|
|
|
b65758 |
--- ./plugins/imjournal/imjournal.c.time 2016-12-21 17:50:13.849000000 +0100
|
|
|
b65758 |
+++ ./plugins/imjournal/imjournal.c 2016-12-21 18:20:03.908000000 +0100
|
|
|
b65758 |
@@ -538,7 +538,24 @@ loadJournalState(void)
|
|
|
b65758 |
"couldn't seek to cursor `%s'\n", readCursor);
|
|
|
b65758 |
iRet = RS_RET_ERR;
|
|
|
b65758 |
} else {
|
|
|
b65758 |
+ char * tmp_cursor = NULL;
|
|
|
b65758 |
sd_journal_next(j);
|
|
|
b65758 |
+ /*
|
|
|
b65758 |
+ * This is resolving the situation when system is after reboot and boot_id doesn't match
|
|
|
b65758 |
+ * so cursor pointing into "future". Usually sd_journal_next jump to head of journal due to journal aproximation,
|
|
|
b65758 |
+ * but when system time goes backwards and cursor is still invalid, rsyslog stops logging. We use
|
|
|
b65758 |
+ * sd_journal_get_cursor to validate our cursor. When cursor is invalid we are trying to jump to the head of journal
|
|
|
b65758 |
+ * This problem with time is not affecting persistent journal.
|
|
|
b65758 |
+ * */
|
|
|
b65758 |
+ if (sd_journal_get_cursor(j, &tmp_cursor) < 0 && sd_journal_has_persistent_files(j) == 0) {
|
|
|
b65758 |
+ errmsg.LogError(0, RS_RET_IO_ERROR, "imjournal: "
|
|
|
b65758 |
+ "loaded invalid cursor, seeking to the head of journal\n");
|
|
|
b65758 |
+ if (sd_journal_seek_head(j) < 0) {
|
|
|
b65758 |
+ errmsg.LogError(0, RS_RET_ERR, "imjournal: "
|
|
|
b65758 |
+ "sd_journal_seek_head() failed, when cursor is invalid\n");
|
|
|
b65758 |
+ iRet = RS_RET_ERR;
|
|
|
b65758 |
+ }
|
|
|
b65758 |
+ }
|
|
|
b65758 |
}
|
|
|
b65758 |
} else {
|
|
|
b65758 |
errmsg.LogError(0, RS_RET_IO_ERROR, "imjournal: "
|