From 0df1c86562e5ea85422594229f39a40c7fa39998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Ferrand?= Date: Tue, 16 Jan 2024 18:12:08 +0100 Subject: [PATCH] feat: Adapt log format if journald is detected * Journald has already informations such as hostname or datetime --- docker-ingress-routing-daemon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-ingress-routing-daemon b/docker-ingress-routing-daemon index 267a824..dd69c80 100755 --- a/docker-ingress-routing-daemon +++ b/docker-ingress-routing-daemon @@ -28,6 +28,13 @@ VERSION=4.1.1 # Workaround for https://github.com/moby/moby/issues/25526 log() { + if [ -n "${JOURNAL_STREAM}" ] + then + # Launched with systemd and journald + echo "$@" + return + fi + [ -z "$_BASHPID" ] && _BASHPID="$BASHPID" local D=$(date +%Y-%m-%d.%H:%M:%S.%N) local S=$(printf "%s|%s|%05d|" "${D:0:26}" "$HOSTNAME" "$_BASHPID")