chiark / gitweb /
man: mention docker as type of virtualization
[elogind.git] / src / journal / journalctl.c
index d00a815ba9ce3d06fe934de026c36520f6782cdb..816934ee6bedb0dd7324f33716d14d7b7431ec63 100644 (file)
@@ -63,6 +63,7 @@
 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
 
 static OutputMode arg_output = OUTPUT_SHORT;
+static bool arg_utc = false;
 static bool arg_pager_end = false;
 static bool arg_follow = false;
 static bool arg_full = true;
@@ -191,6 +192,7 @@ static void help(void) {
                "  -o --output=STRING       Change journal output mode (short, short-iso,\n"
                "                                   short-precise, short-monotonic, verbose,\n"
                "                                   export, json, json-pretty, json-sse, cat)\n"
+               "     --utc                 Express time in Coordinated Universal Time (UTC)\n"
                "  -x --catalog             Add message explanations where available\n"
                "     --no-full             Ellipsize fields\n"
                "  -a --all                 Show all fields, including long and unprintable\n"
@@ -250,6 +252,7 @@ static int parse_argv(int argc, char *argv[]) {
                 ARG_DUMP_CATALOG,
                 ARG_UPDATE_CATALOG,
                 ARG_FORCE,
+                ARG_UTC,
         };
 
         static const struct option options[] = {
@@ -299,6 +302,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "update-catalog", no_argument,       NULL, ARG_UPDATE_CATALOG },
                 { "reverse",        no_argument,       NULL, 'r'                },
                 { "machine",        required_argument, NULL, 'M'                },
+                { "utc",            no_argument,       NULL, ARG_UTC            },
                 {}
         };
 
@@ -639,6 +643,10 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_reverse = true;
                         break;
 
+                case ARG_UTC:
+                        arg_utc = true;
+                        break;
+
                 case '?':
                         return -EINVAL;
 
@@ -882,8 +890,8 @@ static int list_boots(sd_journal *j) {
                 printf("% *i " SD_ID128_FORMAT_STR " %s—%s\n",
                        w, i - count + 1,
                        SD_ID128_FORMAT_VAL(id->id),
-                       format_timestamp(a, sizeof(a), id->first),
-                       format_timestamp(b, sizeof(b), id->last));
+                       format_timestamp_internal(a, sizeof(a), id->first, arg_utc),
+                       format_timestamp_internal(b, sizeof(b), id->last, arg_utc));
         }
 
         return 0;
@@ -1029,7 +1037,7 @@ static int get_possible_units(sd_journal *j,
         const char *field;
         int r;
 
-        found = set_new(string_hash_func, string_compare_func);
+        found = set_new(&string_hash_ops);
         if (!found)
                 return log_oom();
 
@@ -1494,8 +1502,8 @@ static int verify(sd_journal *j) {
                         if (arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) {
                                 if (validated > 0) {
                                         log_info("=> Validated from %s to %s, final %s entries not sealed.",
-                                                 format_timestamp(a, sizeof(a), first),
-                                                 format_timestamp(b, sizeof(b), validated),
+                                                 format_timestamp_internal(a, sizeof(a), first, arg_utc),
+                                                 format_timestamp_internal(b, sizeof(b), validated, arg_utc),
                                                  format_timespan(c, sizeof(c), last > validated ? last - validated : 0, 0));
                                 } else if (last > 0)
                                         log_info("=> No sealing yet, %s of entries not sealed.",
@@ -1890,11 +1898,11 @@ int main(int argc, char *argv[]) {
                 if (r > 0) {
                         if (arg_follow)
                                 printf("-- Logs begin at %s. --\n",
-                                       format_timestamp(start_buf, sizeof(start_buf), start));
+                                       format_timestamp_internal(start_buf, sizeof(start_buf), start, arg_utc));
                         else
                                 printf("-- Logs begin at %s, end at %s. --\n",
-                                       format_timestamp(start_buf, sizeof(start_buf), start),
-                                       format_timestamp(end_buf, sizeof(end_buf), end));
+                                       format_timestamp_internal(start_buf, sizeof(start_buf), start, arg_utc),
+                                       format_timestamp_internal(end_buf, sizeof(end_buf), end, arg_utc));
                 }
         }
 
@@ -1939,7 +1947,7 @@ int main(int argc, char *argv[]) {
                                         goto finish;
                         }
 
-                        if (!arg_merge) {
+                        if (!arg_merge && !arg_quiet) {
                                 sd_id128_t boot_id;
 
                                 r = sd_journal_get_monotonic_usec(j, NULL, &boot_id);
@@ -1958,7 +1966,8 @@ int main(int argc, char *argv[]) {
                                 arg_all * OUTPUT_SHOW_ALL |
                                 arg_full * OUTPUT_FULL_WIDTH |
                                 on_tty() * OUTPUT_COLOR |
-                                arg_catalog * OUTPUT_CATALOG;
+                                arg_catalog * OUTPUT_CATALOG |
+                                arg_utc * OUTPUT_UTC;
 
                         r = output_journal(stdout, j, arg_output, 0, flags, &ellipsized);
                         need_seek = true;