Skip to content

Commit 7b3f8ee

Browse files
Merge pull request #27 from Marissa-working/master
add logrotate & its cron job for log files in /var/log/httpd dir(test parameters)
2 parents da69526 + 5f0d4b7 commit 7b3f8ee

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Dockerfile.testing

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN \
99
yum update -y && \
1010
(yum install -y git-core || yum install -y git) && \
1111
yum install -y --enablerepo=osg-upcoming condor && \
12-
yum install -y python3-pip httpd mod_auth_openidc mod_ssl python3-mod_wsgi && \
12+
yum install -y python3-pip httpd mod_auth_openidc mod_ssl python3-mod_wsgi logrotate && \
1313
yum install -y make && \
1414
yum clean all && rm -rf /var/cache/yum/*
1515

@@ -28,8 +28,12 @@ RUN pip3 install -U pip && pip3 install -r /opt/registry/requirements.txt
2828
# Use our weird grid-security cert/key location
2929
RUN rm /etc/httpd/conf.d/ssl.conf
3030

31+
# Setup cron job for logrotate to run as root every day
32+
RUN echo "0 0 * * * root /usr/sbin/logrotate /etc/logrotate.d/httpd >> /var/log/cron 2>&1" > /etc/cron.d/logrotate-httpd
33+
3134
COPY register.py /usr/bin
3235
COPY supervisor-apache.conf /etc/supervisord.d/40-apache.conf
36+
COPY logrotate-http.conf /etc/logrotate.d/httpd
3337
COPY examples/apache.conf /etc/httpd/conf.d/
3438

3539
ENV CONFIG_DIR=/srv

logrotate-http.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/var/log/httpd/*.log {
2+
maxsize 100M
3+
rotate 20
4+
missingok
5+
notifempty
6+
compress
7+
delaycompress
8+
sharedscripts
9+
postrotate
10+
PID=$(pgrep -o httpd); if [ "$PID" ]; then kill -USR1 $PID; fi
11+
endscript
12+
}

0 commit comments

Comments
 (0)