chiark / gitweb /
split selinux label operations out of cgroup-util, socket-util
[elogind.git] / src / logs-show.c
index f71c6b08455d8823d29b8fd10b064a8b23bf4d58..42d84edbafd43eb5c7b3b5224d3d34a1acba109d 100644 (file)
@@ -213,7 +213,8 @@ static int output_short(sd_journal *j, unsigned line, unsigned n_columns, bool s
         } else if (comm && shall_print(show_all, comm, comm_len)) {
                 printf(" %.*s", (int) comm_len, comm);
                 n += comm_len + 1;
-        }
+        } else
+                putchar(' ');
 
         if (pid && shall_print(show_all, pid, pid_len)) {
                 printf("[%.*s]", (int) pid_len, pid);
@@ -347,10 +348,10 @@ static int output_export(sd_journal *j, unsigned line, unsigned n_columns, bool
                 return r;
         }
 
-        printf(".cursor=%s\n"
-               ".realtime=%llu\n"
-               ".monotonic=%llu\n"
-               ".boot_id=%s\n",
+        printf("__CURSOR=%s\n"
+               "__REALTIME_TIMESTAMP=%llu\n"
+               "__MONOTONIC_TIMESTAMP=%llu\n"
+               "_BOOT_ID=%s\n",
                cursor,
                (unsigned long long) realtime,
                (unsigned long long) monotonic,
@@ -360,6 +361,12 @@ static int output_export(sd_journal *j, unsigned line, unsigned n_columns, bool
 
         SD_JOURNAL_FOREACH_DATA(j, data, length) {
 
+                /* We already printed the boot id, from the data in
+                 * the header, hence let's suppress it here */
+                if (length >= 9 &&
+                    memcmp(data, "_BOOT_ID=", 9) == 0)
+                        continue;
+
                 if (contains_unprintable(data, length)) {
                         const char *c;
                         uint64_t le64;
@@ -459,10 +466,10 @@ static int output_json(sd_journal *j, unsigned line, unsigned n_columns, bool sh
                 fputs(",\n", stdout);
 
         printf("{\n"
-               "\t\".cursor\" : \"%s\",\n"
-               "\t\".realtime\" : %llu,\n"
-               "\t\".monotonic\" : %llu,\n"
-               "\t\".boot_id\" : \"%s\"",
+               "\t\"__CURSOR\" : \"%s\",\n"
+               "\t\"__REALTIME_TIMESTAMP\" : \"%llu\",\n"
+               "\t\"__MONOTONIC_TIMESTAMP\" : \"%llu\",\n"
+               "\t\"_BOOT_ID\" : \"%s\"",
                cursor,
                (unsigned long long) realtime,
                (unsigned long long) monotonic,
@@ -473,6 +480,12 @@ static int output_json(sd_journal *j, unsigned line, unsigned n_columns, bool sh
         SD_JOURNAL_FOREACH_DATA(j, data, length) {
                 const char *c;
 
+                /* We already printed the boot id, from the data in
+                 * the header, hence let's suppress it here */
+                if (length >= 9 &&
+                    memcmp(data, "_BOOT_ID=", 9) == 0)
+                        continue;
+
                 c = memchr(data, '=', length);
                 if (!c) {
                         log_error("Invalid field.");