summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2021-10-12 11:03:44 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2021-10-18 16:48:06 +0100
commit012181eaef0792f4feff9cc2dbaab629291d1b5d (patch)
tree01c2dd5cbc52e43b01aad90848ad74f0b347ec0c
parentc8e6e1f10d8a3f3a0bd7f484c73aadc87602de4d (diff)
downloadsystemd-012181eaef0792f4feff9cc2dbaab629291d1b5d.tar.gz
journal: Add two more log messages to journal_file_rotate_suggested()
This ensures every reason for rotation has an associated log message.
-rw-r--r--src/libsystemd/sd-journal/journal-file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
index c7186fdb37..9f8b02d89b 100644
--- a/src/libsystemd/sd-journal/journal-file.c
+++ b/src/libsystemd/sd-journal/journal-file.c
@@ -4168,8 +4168,12 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log
if (JOURNAL_HEADER_CONTAINS(f->header, n_data) &&
JOURNAL_HEADER_CONTAINS(f->header, n_fields) &&
le64toh(f->header->n_data) > 0 &&
- le64toh(f->header->n_fields) == 0)
+ le64toh(f->header->n_fields) == 0) {
+ log_full(log_level,
+ "Data objects of %s are not indexed by field objects, suggesting rotation.",
+ f->path);
return true;
+ }
if (max_file_usec > 0) {
usec_t t, h;
@@ -4177,8 +4181,12 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log
h = le64toh(f->header->head_entry_realtime);
t = now(CLOCK_REALTIME);
- if (h > 0 && t > h + max_file_usec)
+ if (h > 0 && t > h + max_file_usec) {
+ log_full(log_level,
+ "Oldest entry in %s is older than the configured file retention duration (%s), suggesting rotation.",
+ f->path, FORMAT_TIMESPAN(max_file_usec, USEC_PER_SEC));
return true;
+ }
}
return false;