chiark / gitweb /
relicense to LGPLv2.1 (with exceptions)
[elogind.git] / src / logs-show.c
index 0a07a77bed469bec2a4bae569a441d725b009b3c..fedb4532db2505ea5b1bdf385ad312fcf152ded5 100644 (file)
@@ -6,16 +6,16 @@
   Copyright 2012 Lennart Poettering
 
   systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
   systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
+  Lesser General Public License for more details.
 
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
@@ -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);
@@ -348,9 +349,9 @@ static int output_export(sd_journal *j, unsigned line, unsigned n_columns, bool
         }
 
         printf("__CURSOR=%s\n"
-               "__REALTIME=%llu\n"
-               "__MONOTONIC=%llu\n"
-               "__BOOT_ID=%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;
@@ -460,9 +467,9 @@ static int output_json(sd_journal *j, unsigned line, unsigned n_columns, bool sh
 
         printf("{\n"
                "\t\"__CURSOR\" : \"%s\",\n"
-               "\t\"__REALTIME\" : \"%llu\",\n"
-               "\t\"__MONOTONIC\" : \"%llu\",\n"
-               "\t\"__BOOT_ID\" : \"%s\"",
+               "\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.");