summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 4c975d3e7c..43cd2a3fef 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -299,6 +299,8 @@ int main(int argc, char *argv[]) {
sd_journal *j = NULL;
unsigned line = 0;
bool need_seek = false;
+ sd_id128_t previous_boot_id;
+ bool previous_boot_id_valid = false;
log_parse_environment();
log_open();
@@ -390,6 +392,8 @@ int main(int argc, char *argv[]) {
for (;;) {
for (;;) {
+ sd_id128_t boot_id;
+
if (need_seek) {
r = sd_journal_next(j);
if (r < 0) {
@@ -401,6 +405,16 @@ int main(int argc, char *argv[]) {
if (r == 0)
break;
+ r = sd_journal_get_monotonic_usec(j, NULL, &boot_id);
+ if (r >= 0) {
+ if (previous_boot_id_valid &&
+ !sd_id128_equal(boot_id, previous_boot_id))
+ printf(ANSI_HIGHLIGHT_ON "----- Reboot -----" ANSI_HIGHLIGHT_OFF "\n");
+
+ previous_boot_id = boot_id;
+ previous_boot_id_valid = true;
+ }
+
line ++;
r = output_journal(j, arg_output, line, 0, arg_show_all);