mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
journal: Expand rotate log messages in journald
Make sure we always log when we rotate journals and always do so at least at INFO log level. Doing so we make sure there's always a clear reason available explaining why we rotated a journal.
This commit is contained in:
parent
012181eaef
commit
b2b7cf1df5
@ -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)) {
|
||||
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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user