Add logrotate (#25)
All checks were successful
Build Image / Validate Image (push) Successful in 36s
Build Tagged Release Image / Build Image (push) Successful in 5m14s
Build Image / Publish Image (push) Successful in 4m57s
Build Image / Notify (push) Successful in 2s
Build Tagged Release Image / Create Release (push) Successful in 52s
Build Tagged Release Image / Notify (push) Successful in 2s

Adds logrotate, running every day at 00:00.

Rotates `letsencrypt.log`, keeping 10 versions.
Rotates `renew.log` at 100 megabytes

Closes #10

Reviewed-on: #25
Co-authored-by: MrMeeb <mrmeeb@noreply.git.mrmeeb.stream>
Co-committed-by: MrMeeb <mrmeeb@noreply.git.mrmeeb.stream>
This commit is contained in:
MrMeeb 2024-06-02 21:29:42 +00:00
parent d4dd1c57c1
commit c187e05fad
3 changed files with 18 additions and 2 deletions

View File

@ -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 && \

View File

@ -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 ""

15
root/logrotate.conf Normal file
View File

@ -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
}