]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: add -W as short for --no-hostname 38704/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Aug 2025 12:01:25 +0000 (14:01 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 17 Sep 2025 12:27:00 +0000 (14:27 +0200)
--no-hostname is one of the switches I use very often. In particular,
when looking at CI logs, the hostname is almost never interesting.
-H is not yet used in journalctl, because journal operates locally, but
will want it if display of remote journals is implemented. Use -W.

man/journalctl.xml
shell-completion/bash/journalctl
shell-completion/zsh/_journalctl
src/journal/journalctl.c

index cc39ed3af1b99375ec602d81b62b512289367688..82a0c07bdbd2febca8940a7b1221e2f8eae520f3 100644 (file)
       </varlistentry>
 
       <varlistentry>
+        <term><option>-W</option></term>
         <term><option>--no-hostname</option></term>
 
         <listitem><para>Do not show the hostname field of log messages. This switch has an effect only on the
index 08ddae9672bf25213d745a504e8452f6264e2499..fc0fbba664256287542fd53adf7355ba609f88b6 100644 (file)
@@ -47,7 +47,7 @@ _journalctl() {
                       --show-cursor --dmesg -k --pager-end -e -r --reverse
                       --utc -x --catalog --no-full --force --dump-catalog
                       --flush --rotate --sync --relinquish-var
-                      --smart-relinquish-var --no-hostname -N --fields
+                      --smart-relinquish-var --no-hostname -W -N --fields
                       --list-namespaces --list-invocations -I -v --verbose'
         [ARG]='-b --boot -D --directory -i --file -F --field -t --identifier
                       -T --exclude-identifier --facility -M --machine -o --output
index 6ff3f866f1a714f6d79473455cba0df9d95b764e..17023cb5e5dd731c033963389eb31099559626d8 100644 (file)
@@ -99,7 +99,7 @@ _arguments -s \
     '(- *)'{-h,--help}'[Show this help]' \
     '(- *)--version[Show package version]' \
     '--no-pager[Do not pipe output into a pager]' \
-    --no-hostname"[Don't show the hostname of log messages]" \
+    '(-W --no-hostname)'{-W,--no-hostname}"[Don't show the hostname of log messages]" \
     '(-l --full)'{-l,--full}'[Show long fields in full]' \
     '(-a --all)'{-a,--all}'[Show all fields, including long and unprintable]' \
     '(-f --follow)'{-f,--follow}'[Follow journal]' \
index 4642cf45764ac98ec7cd8d7b34837399070c2de8..93c8d0dde6db6665beb76c25aa92cbed2414d21a 100644 (file)
@@ -274,7 +274,7 @@ static int help(void) {
                "     --show-cursor           Print the cursor after all the entries\n"
                "     --utc                   Express time in Coordinated Universal Time (UTC)\n"
                "  -x --catalog               Add message explanations where available\n"
-               "     --no-hostname           Suppress output of hostname field\n"
+               "  -W --no-hostname           Suppress output of hostname field\n"
                "     --no-full               Ellipsize fields\n"
                "  -a --all                   Show all fields, including long and unprintable\n"
                "  -f --follow                Follow the journal\n"
@@ -367,7 +367,6 @@ static int parse_argv(int argc, char *argv[]) {
                 ARG_VACUUM_SIZE,
                 ARG_VACUUM_FILES,
                 ARG_VACUUM_TIME,
-                ARG_NO_HOSTNAME,
                 ARG_OUTPUT_FIELDS,
                 ARG_NAMESPACE,
                 ARG_LIST_NAMESPACES,
@@ -441,7 +440,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "vacuum-size",          required_argument, NULL, ARG_VACUUM_SIZE          },
                 { "vacuum-files",         required_argument, NULL, ARG_VACUUM_FILES         },
                 { "vacuum-time",          required_argument, NULL, ARG_VACUUM_TIME          },
-                { "no-hostname",          no_argument,       NULL, ARG_NO_HOSTNAME          },
+                { "no-hostname",          no_argument,       NULL, 'W'                      },
                 { "output-fields",        required_argument, NULL, ARG_OUTPUT_FIELDS        },
                 { "namespace",            required_argument, NULL, ARG_NAMESPACE            },
                 { "list-namespaces",      no_argument,       NULL, ARG_LIST_NAMESPACES      },
@@ -454,7 +453,7 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:g:c:S:U:t:T:u:INF:xrM:i:", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:g:c:S:U:t:T:u:INF:xrM:i:W", options, NULL)) >= 0)
 
                 switch (c) {
 
@@ -907,7 +906,7 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_action = ACTION_LIST_FIELD_NAMES;
                         break;
 
-                case ARG_NO_HOSTNAME:
+                case 'W':
                         arg_no_hostname = true;
                         break;