From ded0619ee328ed47fc2c42b8bfa4d8f608ab21f7 Mon Sep 17 00:00:00 2001 From: Marco Malavolti <marco.malavolti@garr.it> Date: Tue, 27 Aug 2024 14:12:03 +0200 Subject: [PATCH] Added eccs_status file and fixed LogRotate for stats. --- api.py | 2 +- eccs-logrotate.conf | 4 ++-- eccs.ini | 2 +- eccs_cron | 2 +- setup-eccs-dev.sh | 2 +- web/index.php | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api.py b/api.py index 72276d1..f25f569 100755 --- a/api.py +++ b/api.py @@ -124,7 +124,7 @@ def parseLog(lines,criteria): rowDate = datetime.strptime(clearDateString(row[1]), '%a %b %d %H:%M:%S %Y').strftime('%Y-%m-%d') - # check for entries to be in range of date of rotated log + # check for entries to be in range of date of rotated log if 'cur_date' in criteria and criteria['cur_date'] != rowDate: continue diff --git a/eccs-logrotate.conf b/eccs-logrotate.conf index 6762a49..55df22b 100644 --- a/eccs-logrotate.conf +++ b/eccs-logrotate.conf @@ -1,6 +1,6 @@ -/home/eccs/logs/eccs-uwsgi-req.log { +/home/eccs/stats/eccs-uwsgi-req.log { su root root - create 664 eccs eccs + create rotate 30 daily nocompress diff --git a/eccs.ini b/eccs.ini index 03a8133..d9bb6a6 100644 --- a/eccs.ini +++ b/eccs.ini @@ -23,7 +23,7 @@ wsgi-file = eccs-wsgi.py plugins = python3,logfile enable-threads = true -req-logger = file:logs/%(project)-uwsgi-req.log +req-logger = file:stats/%(project)-uwsgi-req.log log-maxsize = 100000000 log-format = %(addr)|[%(ctime)]|%(method)|%(uri)|%(uagent)|%(referer) diff --git a/eccs_cron b/eccs_cron index e8b3b60..c3af8ce 100644 --- a/eccs_cron +++ b/eccs_cron @@ -1,5 +1,5 @@ 0 22 * * * root (echo "[start LogRotate]" && /usr/sbin/logrotate -v /etc/logrotate.d/eccs && echo "[end LogRotate]") > /proc/1/fd/1 2>&1 0 1 * * * root /usr/bin/touch /home/eccs/eccs.ini 0 1 * * * root (echo "[start PyFF]" && /usr/local/bin/pyff --loglevel=DEBUG /home/eccs/pyff-config/sps-metadata.xml && echo "[end PyFF]") > /proc/1/fd/1 2>&1 -0 2 * * * root (echo "[start ECCS]" && /bin/bash /home/eccs/cleanAndRunEccs.sh && echo "[end ECCS]") > /proc/1/fd/1 2>&1 +0 2 * * * root (echo "[start ECCS]" && /bin/bash /home/eccs/cleanAndRunEccs.sh && echo "[end ECCS]") 2>&1 | tee /proc/1/fd/1 > /home/eccs/debug/eccs_status 0 8 * * * root (echo "[start ECCS clean]" && /bin/bash /home/eccs/clean7daysOldFiles.sh && echo "[end ECCS clean]") > /proc/1/fd/1 2>&1 diff --git a/setup-eccs-dev.sh b/setup-eccs-dev.sh index 5b28068..6f484a1 100755 --- a/setup-eccs-dev.sh +++ b/setup-eccs-dev.sh @@ -24,4 +24,4 @@ echo "docker exec -it -u eccs -w /home/eccs eccs ./cleanAndRunEccs.sh > /proc/1/ echo "" echo "Delete all results of today" echo "" -echo "docker exec -it -u eccs -w /home/eccs/ eccs rm -rf html/$(date +%Y-%m-%d) output/eccs_$(date +%Y-%m-%d).log logs/*_$(date +%Y-%m-%d).log" +echo "docker exec -it -u eccs -w /home/eccs/ eccs rm -rf html/$(date +%Y-%m-%d) output/eccs_$(date +%Y-%m-%d).log logs/*_$(date +%Y-%m-%d).log stats/*_$(date +%Y-%m-%d).log" diff --git a/web/index.php b/web/index.php index 171d661..b4a4323 100644 --- a/web/index.php +++ b/web/index.php @@ -83,14 +83,14 @@ $data[ 'check_result' ] = htmlspecialchars($_GET[ "check_result" ] ?? null); <div class="clearfix"> <div class="boxStatus"> <strong>Show IdPs with status:</strong> - <label id="lbl-error" for="error">ERROR</label> <input id="error" type="checkbox" name="status" value="ERROR"/> - <label id="lbl-ok" for="ok">OK</label> + <label id="lbl-error" for="error">ERROR</label> <input id="ok" type="checkbox" name="status" value="OK"/> - <label id="lbl-unknown" for="unknown">UNKNOWN</label> + <label id="lbl-ok" for="ok">OK</label> <input id="unknown" type="checkbox" name="status" value="UNKNOWN"/> - <label id="lbl-disabled" for="disabled">DISABLED</label> + <label id="lbl-unknown" for="unknown">UNKNOWN</label> <input id="disabled" type="checkbox" name="status" value="DISABLE"/> + <label id="lbl-disabled" for="disabled">DISABLED</label> </div> <!-- END boxStatus --> <div class="boxCalendar"> <div id="calendarGo"> -- GitLab