summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-20 20:09:57 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-22 16:16:59 +0200
commit991e274b61f489e625274254138567c9c81b4c4b (patch)
tree38464ce4173c2e3e1bbff3e5a56bf0eb257128da /src/shared
parentbb321ed9a33d6c90e2529db86ffabd913805088a (diff)
journalctl: add --no-hostname switch
This suppresses output of the hostname for messages from the local system. Fixes: #2342
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/logs-show.c6
-rw-r--r--src/shared/output-mode.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 5cfa455e05..cd3d53669c 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -373,6 +373,12 @@ static int output_short(
n += strlen(buf);
}
+ if (hostname && (flags & OUTPUT_NO_HOSTNAME)) {
+ /* Suppress display of the hostname if this is requested. */
+ hostname = NULL;
+ hostname_len = 0;
+ }
+
if (hostname && shall_print(hostname, hostname_len, flags)) {
fprintf(f, " %.*s", (int) hostname_len, hostname);
n += hostname_len + 1;
diff --git a/src/shared/output-mode.h b/src/shared/output-mode.h
index 56fd3ba8e3..f37189e57f 100644
--- a/src/shared/output-mode.h
+++ b/src/shared/output-mode.h
@@ -50,6 +50,7 @@ typedef enum OutputFlags {
OUTPUT_BEGIN_NEWLINE = 1 << 6,
OUTPUT_UTC = 1 << 7,
OUTPUT_KERNEL_THREADS = 1 << 8,
+ OUTPUT_NO_HOSTNAME = 1 << 9,
} OutputFlags;
const char* output_mode_to_string(OutputMode m) _const_;