diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-10-19 09:53:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 09:53:31 +0200 |
commit | 33539ffe59341f6af5787cd647c98fe434aa5c87 (patch) | |
tree | da6b913b1d2475a972d2525ec59513a7d898ca4a /src/journal | |
parent | Merge pull request #21037 from yuwata/network-dhcp6-pd-simplify-distribute (diff) | |
parent | journal: Expand rotate log messages in journald (diff) | |
download | systemd-33539ffe59341f6af5787cd647c98fe434aa5c87.tar.xz systemd-33539ffe59341f6af5787cd647c98fe434aa5c87.zip |
Merge pull request #20988 from DaanDeMeyer/rotate-reason
journal: Improve rotation logging
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald-server.c | 14 | ||||
-rw-r--r-- | src/journal/journald.c | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index c93499bbc6..7aa734d2d3 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -811,7 +811,7 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, size_t n * to ensure that the entries in the journal files are strictly ordered by time, in order to ensure * bisection works correctly. */ - log_debug("Time jumped backwards, rotating."); + log_info("Time jumped backwards, rotating."); rotate = true; } else { @@ -819,8 +819,8 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, size_t n if (!f) return; - if (journal_file_rotate_suggested(f, s->max_file_usec)) { - log_debug("%s: Journal header limits reached or header out-of-date, rotating.", f->path); + if (journal_file_rotate_suggested(f, s->max_file_usec, LOG_INFO)) { + log_info("%s: Journal header limits reached or header out-of-date, rotating.", f->path); rotate = true; } } @@ -848,6 +848,8 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, size_t n return; } + log_info_errno(r, "Failed to write entry (%zu items, %zu bytes), rotating before retrying: %m", n, IOVEC_TOTAL_SIZE(iovec, n)); + server_rotate(s); server_vacuum(s, false); @@ -1172,6 +1174,8 @@ int server_flush_to_var(Server *s, bool require_flag_file) { goto finish; } + log_info("Rotating system journal."); + server_rotate(s); server_vacuum(s, false); @@ -1428,7 +1432,7 @@ static int dispatch_sigusr2(sd_event_source *es, const struct signalfd_siginfo * assert(s); - log_info("Received SIGUSR2 signal from PID " PID_FMT ", as request to rotate journal.", si->ssi_pid); + log_info("Received SIGUSR2 signal from PID " PID_FMT ", as request to rotate journal, rotating.", si->ssi_pid); server_full_rotate(s); return 0; @@ -1970,7 +1974,7 @@ static int vl_method_rotate(Varlink *link, JsonVariant *parameters, VarlinkMetho if (json_variant_elements(parameters) > 0) return varlink_error_invalid_parameter(link, parameters); - log_info("Received client request to rotate journal."); + log_info("Received client request to rotate journal, rotating."); server_full_rotate(s); return varlink_reply(link, NULL); diff --git a/src/journal/journald.c b/src/journal/journald.c index 536717ce0a..94aad05de9 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { /* The retention time is reached, so let's vacuum! */ if (server.oldest_file_usec + server.max_retention_usec < n) { - log_info("Retention time reached."); + log_info("Retention time reached, rotating."); server_rotate(&server); server_vacuum(&server, false); continue; |