mirror of
https://github.com/caprover/caprover
synced 2025-12-03 18:15:42 +00:00
Process logs improvements
This commit is contained in:
@@ -10,6 +10,7 @@ COPY ./dockerfiles/goaccess-files/crontab.txt /var/spool/cron/crontabs/root
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# https://blog.thesparktree.com/cron-in-docker
|
||||
# source: `docker run --rm -it alpine crond -h`
|
||||
# -f | Foreground
|
||||
# -l N | Set log level. Most verbose 0, default 8
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
currentDateTime=$(date +"%Y-%m-%dT%H:%M")
|
||||
|
||||
for folder in /var/www/logs/*; do
|
||||
if [ -d "$folder" ]; then
|
||||
logFile="access.log"
|
||||
|
||||
if [ -s "$folder/$logFile" ]; then
|
||||
rotatedLog="$folder/$currentDateTime.log"
|
||||
report="$folder/$currentDateTime.html"
|
||||
|
||||
if [ -f "$report" ]; then
|
||||
echo "$report already exists, skipping"
|
||||
else
|
||||
echo "Processing $report"
|
||||
|
||||
# Manually rotate the log files
|
||||
cp "$folder/$logFile" $rotatedLog
|
||||
truncate -s 0 "$folder/$logFile"
|
||||
|
||||
goaccess $rotatedLog -a -o "$report" --log-format=COMBINED
|
||||
|
||||
gzip $rotatedLog
|
||||
fi
|
||||
|
||||
else
|
||||
echo "File $folder/$logFile does not exist or is empty"
|
||||
fi
|
||||
|
||||
for file in /var/www/logs/*.log; do
|
||||
report=${file%.log}.html
|
||||
|
||||
if [ -f $report ]; then
|
||||
echo "$report already exists, skipping"
|
||||
else
|
||||
echo "Processing $report"
|
||||
goaccess $file -a -o $report --log-format=COMBINED
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
@@ -393,7 +393,7 @@ class LoadBalancerManager {
|
||||
|
||||
getLogPath(domainName: string) {
|
||||
// The shared volume path plus a filesafe name
|
||||
return `/var/log/nginx-shared/${domainName.replace(/\./g, '')}.log`
|
||||
return `/var/log/nginx-shared/${domainName}/access.log`
|
||||
}
|
||||
|
||||
getInfo() {
|
||||
|
||||
Reference in New Issue
Block a user