aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-logfollow
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-11-02 16:49:12 +0200
committerkaotisk <kaotisk@arching-kaos.org>2023-11-02 16:49:12 +0200
commite2cfcb93135978df20229256447b1a2ca788e2b4 (patch)
tree84bdfba4831ff9480f264c8834970168e017921f /bin/ak-logfollow
parent11d38df23c069e3e039cd4919327c8e494f030a1 (diff)
downloadarching-kaos-tools-e2cfcb93135978df20229256447b1a2ca788e2b4.tar.gz
arching-kaos-tools-e2cfcb93135978df20229256447b1a2ca788e2b4.tar.bz2
arching-kaos-tools-e2cfcb93135978df20229256447b1a2ca788e2b4.zip
Log file reader now formats timestamp in a human readable value
Diffstat (limited to 'bin/ak-logfollow')
-rwxr-xr-xbin/ak-logfollow13
1 files changed, 12 insertions, 1 deletions
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