From 12394152799433c6fe7ea05c2da7bd93b046d960 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 22 Jan 2023 21:28:39 +0100 Subject: [PATCH] get info by week --- roles/deploy-web/files/getinfo_week.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/deploy-web/files/getinfo_week.sh b/roles/deploy-web/files/getinfo_week.sh index ad22593..a865df2 100755 --- a/roles/deploy-web/files/getinfo_week.sh +++ b/roles/deploy-web/files/getinfo_week.sh @@ -26,11 +26,13 @@ do cat $directory_host/output_*.txt |grep "${j}" |sort |uniq -c >> ${MAIL} echo "--------------" >> ${MAIL} done - echo "nombre erreur 400 par IP : " >> ${MAIL} - cat $log_access | awk -F "|" '{ if($2 == "400") print $1}' |sort |uniq -c >> ${MAIL} - echo "--------" >> ${MAIL} - echo "nombre erreur 404 par IP : " >> ${MAIL} - cat $log_access | awk -F "|" '{ if($2 == "404") print $1}' |sort |uniq -c >> ${MAIL} + ERROR=("400" "404") + for j in ${ERROR[@]} + do + echo "nombre erreur ${j} par IP :" >> ${MAIL} + cat $directory_host/${j}_* |sort |uniq -c >> ${MAIL} + echo "----------------" >> ${MAIL} + done cat ${MAIL} |mail -s "Rapport reverse proxy $DATE" valczebackup@gmail.com #rm $directory_host/* done