diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-04-04 01:00:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-04-04 01:00:09 +0200 |
commit | 112301ae4433b59ae602556f455c4065bddb6ad6 (patch) | |
tree | dface1344742a47e65ace1fd8684e1c35f48e289 /src | |
parent | 6bc3bf5b05f4e79f9d6e42b7fb877b60070e048b (diff) |
journal: don't export the boot id twice per entry
Diffstat (limited to 'src')
-rw-r--r-- | src/logs-show.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/logs-show.c b/src/logs-show.c index 158223fc0a..a6220351b6 100644 --- a/src/logs-show.c +++ b/src/logs-show.c @@ -350,7 +350,7 @@ static int output_export(sd_journal *j, unsigned line, unsigned n_columns, bool printf("__CURSOR=%s\n" "__REALTIME_TIMESTAMP=%llu\n" "__MONOTONIC_TIMESTAMP=%llu\n" - "__BOOT_ID=%s\n", + "_BOOT_ID=%s\n", cursor, (unsigned long long) realtime, (unsigned long long) monotonic, @@ -360,6 +360,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; @@ -462,7 +468,7 @@ static int output_json(sd_journal *j, unsigned line, unsigned n_columns, bool sh "\t\"__CURSOR\" : \"%s\",\n" "\t\"__REALTIME_TIMESTAMP\" : \"%llu\",\n" "\t\"__MONOTONIC_TIMESTAMP\" : \"%llu\",\n" - "\t\"__BOOT_ID\" : \"%s\"", + "\t\"_BOOT_ID\" : \"%s\"", cursor, (unsigned long long) realtime, (unsigned long long) monotonic, @@ -473,6 +479,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."); |