Make Background Service Emergency Delete Logs (#4161)

This commit is contained in:
/rootzoll 2023-09-10 17:14:56 +02:00 committed by GitHub
parent a6a15dc834
commit 672f980335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View File

@ -250,6 +250,30 @@ do
fi
fi
###############################
# SYSTEM LOG FILE SIZES
###############################
# check every 15min
recheckSync=$(($counter % 900))
if [ ${recheckSync} -eq 1 ]; then
echo "*** CHECK LOG FILE SIZES ***"
# check if log file is getting too big
logsMegaByte=$(sudo du -c -m /var/log | grep "total" | awk '{print $1;}')
if [ ${logsMegaByte} -gt 5000 ]; then
echo "WARN # Logs /var/log in are bigger then 5GB .. starting repair"
debuginfo=$(ls -la /var/log/ 2>/dev/null)
# dont delete directories - can make services crash
sudo rm /var/log/*
sudo service rsyslog restart
/home/admin/config.scripts/blitz.error.sh _background.sh "log-delete" "REPAIR: /var/log/ >5GB" "Logs in /var/log in were bigger then 5GB and got emergency delete to prevent fillup." "${debuginfo}"
sleep 10
else
echo "OK - logs are at ${logsMegaByte} MB - within safety limit"
fi
echo ""
fi
####################################################
# MONITOR Initial Syncing of Bitcoin & Lightning
# - turn off recovery mode

View File

@ -181,6 +181,7 @@ if [ ${logsMegaByte} -gt 1000 ]; then
sudo service rsyslog restart
/home/admin/_cache.sh set message "WARNING: /var/log/ >1GB"
echo "WARN # Logs in /var/log in were bigger then 1GB and got emergency delete to prevent fillup." >> $logFile
sudo ls -la /var/log >> $logFile
echo "If you see this in the logs please report to the GitHub issues, so LOG config needs to be optimized." >> $logFile
sleep 10
else

View File

@ -467,6 +467,10 @@ echo "*** SYSTEM CACHE STATUS ***"
/home/admin/_cache.sh "export" ln_default | grep -v "ln_default_address"
/home/admin/_cache.sh "export" btc_default | grep -v "btc_default_address"
echo "*** POSSIBLE ERROR REPORTS ***"
ls -1 /home/admin/error* 2>/dev/null
echo
echo
echo "*** OPTION: SHARE THIS DEBUG OUTPUT ***"
echo "An easy way to share this debug output on GitHub or on a support chat"