Skip to content

Commit dd35c9c

Browse files
author
Marissa Zhang
committed
add logrotate & its cron job for log files in /var/log/httpd dir(testing parameters)
1 parent da69526 commit dd35c9c

2 files changed

Lines changed: 19 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 every 5 minutes
32+
RUN crontab -l | { cat; echo "* * * * * /usr/sbin/logrotate /etc/logrotate.d/httpd >> /var/log/cron 2>&1"; } | crontab -
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/var/log/httpd/*.log {
2+
maxsize 10K
3+
dateext
4+
dateformat -%Y%m%d-%s
5+
rotate 2
6+
missingok
7+
notifempty
8+
compress
9+
delaycompress
10+
sharedscripts
11+
postrotate
12+
PID=$(pgrep -o httpd) && kill -USR1 $PID
13+
endscript
14+
}

0 commit comments

Comments
 (0)