From 02e02e8465456a3e724ed471f242ee1eb20af725 Mon Sep 17 00:00:00 2001 From: Vijaye Raji Date: Thu, 20 Jan 2022 00:18:22 -0800 Subject: [PATCH] Cleanup older log lines. We keep 2000 lines which should cover a bit more than a month at 30min checks. You can modify this to suit your needs. --- health-check.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/health-check.sh b/health-check.sh index a4ef0dc..4248f6e 100644 --- a/health-check.sh +++ b/health-check.sh @@ -49,6 +49,8 @@ do if [[ $commit == true ]] then echo $dateTime, $result >> "logs/${key}_report.log" + # By default we keep 2000 last log entries. Feel free to modify this to meet your needs. + echo "$(tail -2000 logs/${key}_report.log)" > "logs/${key}_report.log" else echo " $dateTime, $result" fi