mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
journalctl: print monotonic timestamp in --header
This commit is contained in:
parent
2765b7bb69
commit
ed375bebf4
@ -2272,7 +2272,7 @@ fail:
|
||||
|
||||
void journal_file_print_header(JournalFile *f) {
|
||||
char a[33], b[33], c[33], d[33];
|
||||
char x[FORMAT_TIMESTAMP_MAX], y[FORMAT_TIMESTAMP_MAX];
|
||||
char x[FORMAT_TIMESTAMP_MAX], y[FORMAT_TIMESTAMP_MAX], z[FORMAT_TIMESTAMP_MAX];
|
||||
struct stat st;
|
||||
char bytes[FORMAT_BYTES_MAX];
|
||||
|
||||
@ -2295,6 +2295,7 @@ void journal_file_print_header(JournalFile *f) {
|
||||
"Tail Sequential Number: %"PRIu64"\n"
|
||||
"Head Realtime Timestamp: %s\n"
|
||||
"Tail Realtime Timestamp: %s\n"
|
||||
"Tail Monotonic Timestamp: %s\n"
|
||||
"Objects: %"PRIu64"\n"
|
||||
"Entry Objects: %"PRIu64"\n",
|
||||
f->path,
|
||||
@ -2318,6 +2319,7 @@ void journal_file_print_header(JournalFile *f) {
|
||||
le64toh(f->header->tail_entry_seqnum),
|
||||
format_timestamp(x, sizeof(x), le64toh(f->header->head_entry_realtime)),
|
||||
format_timestamp(y, sizeof(y), le64toh(f->header->tail_entry_realtime)),
|
||||
format_timespan(z, sizeof(z), le64toh(f->header->tail_entry_monotonic), USEC_PER_MSEC),
|
||||
le64toh(f->header->n_objects),
|
||||
le64toh(f->header->n_entries));
|
||||
|
||||
@ -2596,7 +2598,7 @@ int journal_file_open_reliably(
|
||||
|
||||
int r;
|
||||
size_t l;
|
||||
char *p;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
r = journal_file_open(fname, flags, mode, compress, seal,
|
||||
metrics, mmap_cache, template, ret);
|
||||
@ -2627,7 +2629,6 @@ int journal_file_open_reliably(
|
||||
return -ENOMEM;
|
||||
|
||||
r = rename(fname, p);
|
||||
free(p);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
|
@ -245,7 +245,7 @@ finish:
|
||||
}
|
||||
|
||||
static JournalFile* find_journal(Server *s, uid_t uid) {
|
||||
char *p;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r;
|
||||
JournalFile *f;
|
||||
sd_id128_t machine;
|
||||
@ -283,8 +283,6 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
|
||||
}
|
||||
|
||||
r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, s->system_journal, &f);
|
||||
free(p);
|
||||
|
||||
if (r < 0)
|
||||
return s->system_journal;
|
||||
|
||||
@ -372,7 +370,6 @@ void server_sync(Server *s) {
|
||||
}
|
||||
|
||||
void server_vacuum(Server *s) {
|
||||
char *p;
|
||||
char ids[33];
|
||||
sd_id128_t machine;
|
||||
int r;
|
||||
@ -390,29 +387,19 @@ void server_vacuum(Server *s) {
|
||||
sd_id128_to_string(machine, ids);
|
||||
|
||||
if (s->system_journal) {
|
||||
p = strappend("/var/log/journal/", ids);
|
||||
if (!p) {
|
||||
log_oom();
|
||||
return;
|
||||
}
|
||||
char *p = strappenda("/var/log/journal/", ids);
|
||||
|
||||
r = journal_directory_vacuum(p, s->system_metrics.max_use, s->system_metrics.keep_free, s->max_retention_usec, &s->oldest_file_usec);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_error("Failed to vacuum %s: %s", p, strerror(-r));
|
||||
free(p);
|
||||
}
|
||||
|
||||
if (s->runtime_journal) {
|
||||
p = strappend("/run/log/journal/", ids);
|
||||
if (!p) {
|
||||
log_oom();
|
||||
return;
|
||||
}
|
||||
char *p = strappenda("/run/log/journal/", ids);
|
||||
|
||||
r = journal_directory_vacuum(p, s->runtime_metrics.max_use, s->runtime_metrics.keep_free, s->max_retention_usec, &s->oldest_file_usec);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_error("Failed to vacuum %s: %s", p, strerror(-r));
|
||||
free(p);
|
||||
}
|
||||
|
||||
s->cached_available_space_timestamp = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user