summaryrefslogtreecommitdiff
path: root/src/shared/logs-show.c
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/logs-show.c
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/logs-show.c')
-rw-r--r--src/shared/logs-show.c6
1 files changed, 6 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;