From 827e212fc087622564582c545ffd01cc7d678b93 Mon Sep 17 00:00:00 2001 From: Mohammad Javad Naderi Date: Sat, 24 Aug 2024 12:47:34 +0330 Subject: [PATCH] Use ISO8601 date format in logs --- client/entrypoint.sh | 4 ++-- server/entrypoint.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/entrypoint.sh b/client/entrypoint.sh index 7a66498..91b8e89 100644 --- a/client/entrypoint.sh +++ b/client/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh log_with_timestamp() { - echo -e "$1" | awk '{ print strftime("[%Y-%m-%d %H:%M:%S%z]"), $0 }' + echo -e "$1" | awk '{ "date -Iseconds" | getline d; print d, $0 }' } # Ensure the script is not run by the "root" user. @@ -107,5 +107,5 @@ if [ -n "${SCHEDULE}" ]; then exec supercronic "${HOME}/crontab" else log_with_timestamp "Running $1..." - exec "$@" 2>&1 | awk '{ print strftime("[%Y-%m-%d %H:%M:%S%z]"), $0 }' + exec "$@" 2>&1 | awk '{ "date -Iseconds" | getline d; print d, $0 }' fi diff --git a/server/entrypoint.sh b/server/entrypoint.sh index 8be02b0..fc3d171 100644 --- a/server/entrypoint.sh +++ b/server/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh log_with_timestamp() { - echo -e "$1" | awk '{ print strftime("[%Y-%m-%d %H:%M:%S%z]"), $0 }' + echo -e "$1" | awk '{ "date -Iseconds" | getline d; print d, $0 }' } # Ensure the script is not run by the "root" user. @@ -101,4 +101,4 @@ AllowUsers sshuser ################################ # Start sshd # ################################ -exec /usr/sbin/sshd -D -e -f "${HOME}/sshd/sshd.conf" 2>&1 | awk '{ print strftime("[%Y-%m-%d %H:%M:%S%z]"), $0 }' +exec /usr/sbin/sshd -D -e -f "${HOME}/sshd/sshd.conf" 2>&1 | awk '{ "date -Iseconds" | getline d; print d, $0 }'