chiark / gitweb /
log-show: look at everything in /run/log/journal
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Feb 2013 04:51:41 +0000 (05:51 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 Feb 2013 04:16:58 +0000 (23:16 -0500)
Logs written by journald from the initramfs may be written to a
directory with the name created from a random machine-id. Afterwards,
when the root filesystem has been mounted and machine-id reinitalized,
logs will be written to the directory with a name created from the
proper machine-id. When logs are flushed to /var/log/journal,
everything is copied to one output directory.

When journalctl without '-m' is run after the logs have been flushed
to /var/log/journal, all messages are shown. However, when run while
logs are still in /run/log/journal, those stored under the random
machine-id will not be shown.

Make journalctl behave the same regardless whether persistent storage
has been enabled or not, and slurp all files from /run/log/journal
even without '-m'.

src/journal/sd-journal.c

index 89045600942d8f6af9b9d943e0d54f7a0eb7599d..19123544b34bd5dcd3f31f7b044bd1aea46667be 100644 (file)
@@ -1321,10 +1321,12 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
         assert(prefix);
         assert(dirname);
 
         assert(prefix);
         assert(dirname);
 
+        log_debug("Considering %s/%s.", prefix, dirname);
+
         if ((j->flags & SD_JOURNAL_LOCAL_ONLY) &&
             (sd_id128_from_string(dirname, &id) < 0 ||
              sd_id128_get_machine(&mid) < 0 ||
         if ((j->flags & SD_JOURNAL_LOCAL_ONLY) &&
             (sd_id128_from_string(dirname, &id) < 0 ||
              sd_id128_get_machine(&mid) < 0 ||
-             !sd_id128_equal(id, mid)))
+             !(sd_id128_equal(id, mid) || path_startswith(prefix, "/run"))))
             return 0;
 
         path = strjoin(prefix, "/", dirname, NULL);
             return 0;
 
         path = strjoin(prefix, "/", dirname, NULL);