summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-09 10:32:38 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-17 00:03:12 +0200
commit089842938dd0f4080084044bb9a1a3b00137926a (patch)
treeba0e7b04ac312b2f29ee8f3fd99d8c0ed353a5b9 /src/journal/journalctl.c
parent8db4213e7b38ebc54bfdc7215991cc23b9580e3a (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/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 9d4403267e..e9d918a733 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -281,6 +281,26 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ if (!arg_quiet) {
+ usec_t start, end;
+ char start_buf[FORMAT_TIMESTAMP_MAX], end_buf[FORMAT_TIMESTAMP_MAX];
+
+ r = sd_journal_get_cutoff_realtime_usec(j, &start, &end);
+ if (r < 0) {
+ log_error("Failed to get cutoff: %s", strerror(-r));
+ goto finish;
+ }
+
+ if (r > 0) {
+ if (arg_follow)
+ printf("Logs begin at %s.\n", format_timestamp(start_buf, sizeof(start_buf), start));
+ else
+ printf("Logs begin at %s, end at %s.\n",
+ format_timestamp(start_buf, sizeof(start_buf), start),
+ format_timestamp(end_buf, sizeof(end_buf), end));
+ }
+ }
+
if (arg_lines >= 0) {
r = sd_journal_seek_tail(j);
if (r < 0) {