diff --git a/Dockerfile b/Dockerfile index a0b96dd..461eae5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ ENV CLOUDFLARE_TOKEN= ENV CERT_COUNT=1 #Get required packages -RUN apk update && apk add curl bash python3 py3-virtualenv procps tzdata nano shadow xz busybox-suid openssl +RUN apk update && apk add curl bash python3 py3-virtualenv procps tzdata nano shadow xz busybox-suid openssl logrotate #Make folders RUN mkdir /config && \ diff --git a/root/certbot-prepare.sh b/root/certbot-prepare.sh index 7931fc0..a8af628 100644 --- a/root/certbot-prepare.sh +++ b/root/certbot-prepare.sh @@ -786,7 +786,8 @@ if [ $ONE_SHOT == "true" ]; then elif [ $ONE_SHOT == "false" ]; then - echo "$INTERVAL /config/.renew-list.sh >> /config/logs/renew.log" > /config/.crontab.txt + echo "$INTERVAL /config/.renew-list.sh >> /config/logs/renew.log + 0 0 * * * logrotate -v --state /config/logs/logrotate.status /logrotate.conf" > /config/.crontab.txt echo "" diff --git a/root/logrotate.conf b/root/logrotate.conf new file mode 100644 index 0000000..a5efd31 --- /dev/null +++ b/root/logrotate.conf @@ -0,0 +1,15 @@ +missingok + +/config/logs/letsencrypt.log { + daily + rotate 10 + postrotate + find /config/logs -type f -regex '.*letsencrypt\.log\.\(.[2-9]\|[2-9].\|[1-9][0-9]\{2,\}\).*' -delete + endscript +} + +/config/logs/renew.log { + rotate 5 + size 100k + compress +} \ No newline at end of file