From e2cfcb93135978df20229256447b1a2ca788e2b4 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 2 Nov 2023 16:49:12 +0200 Subject: Log file reader now formats timestamp in a human readable value --- bin/ak-logfollow | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/ak-logfollow b/bin/ak-logfollow index 61eaa8f..3b75051 100755 --- a/bin/ak-logfollow +++ b/bin/ak-logfollow @@ -1,2 +1,13 @@ #!/bin/bash -tail -f $AK_LOGSFILE +tail -f $AK_LOGSFILE | while read -r p || [ -n "$p" ] +do + timestamp="$(echo "$p" | awk '{print $1}')" + program="$(echo "$p" | awk '{print $2}')" + messagetype="$(echo "$p" | awk '{print $3}')" + message="$(echo "$p" | cut -d ' ' -f4-)" + printf '%s %s %s %s\n' \ + "$(date --date=@$timestamp +%Y%m%d_%H%M%S)" \ + "$program" \ + "$messagetype" \ + "$message" +done -- cgit v1.2.3