diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-06-09 10:32:38 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-06-17 00:03:12 +0200 |
commit | 089842938dd0f4080084044bb9a1a3b00137926a (patch) | |
tree | ba0e7b04ac312b2f29ee8f3fd99d8c0ed353a5b9 /src/shared/logs-show.c | |
parent | 8db4213e7b38ebc54bfdc7215991cc23b9580e3a (diff) |
journal: expose and make use of cutoff times of journal
This helps explaining when the log output of "systemctl status" is
incomplete because the logs got rotated since the service was started.
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r-- | src/shared/logs-show.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 4c59ca34cd..697b5cf4b7 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -551,7 +551,8 @@ int show_journal_by_unit( usec_t not_before, unsigned how_many, bool show_all, - bool follow) { + bool follow, + bool warn_cutoff) { char *m = NULL; sd_journal *j = NULL; @@ -639,6 +640,26 @@ int show_journal_by_unit( goto finish; } + if (warn_cutoff && line < how_many && not_before > 0) { + sd_id128_t boot_id; + usec_t cutoff; + + /* Check whether the cutoff line is too early */ + + r = sd_id128_get_boot(&boot_id); + if (r < 0) + goto finish; + + r = sd_journal_get_cutoff_monotonic_usec(j, boot_id, &cutoff, NULL); + if (r < 0) + goto finish; + + if (not_before < cutoff) + printf("Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.\n"); + + warn_cutoff = false; + } + if (!follow) break; |