From fc203b7139f327f075efef8707125d3ef596afb0 Mon Sep 17 00:00:00 2001 From: Mark Calvert Date: Fri, 23 Feb 2024 16:21:30 +1300 Subject: [PATCH] Removed logrotate and consolidated logs into one ckan.log --- ckan/Dockerfile.worker | 5 ----- ckan/docker-entrypoint.d/02_setup_dbca.sh | 2 -- ckan/setup/dbca_ckan_cron_jobs | 2 -- ckan/setup/dbca_ckan_rotate_logs | 10 ---------- ckan/supervisor/ckan_cron_jobs.conf | 2 +- ckan/supervisor/ckan_worker_bulk.conf | 2 +- ckan/supervisor/ckan_worker_default.conf | 2 +- ckan/supervisor/ckan_worker_priority.conf | 2 +- 8 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 ckan/setup/dbca_ckan_rotate_logs diff --git a/ckan/Dockerfile.worker b/ckan/Dockerfile.worker index 81430006..18b681fe 100644 --- a/ckan/Dockerfile.worker +++ b/ckan/Dockerfile.worker @@ -5,11 +5,6 @@ FROM ${CKAN_IMAGE} ENV CKAN__PLUGINS="dbca activity datastore xloader scheming_datasets qa archiver report envvars" RUN ckan config-tool $CKAN_INI "ckan.plugins = ${CKAN__PLUGINS}" -# Install logrotate -RUN apk add logrotate -# Create logrotate config file for app logs -COPY setup/dbca_ckan_rotate_logs /etc/logrotate.d/dbca_ckan_rotate_logs - ## Supervisor config COPY supervisor/*.conf /etc/supervisord.d diff --git a/ckan/docker-entrypoint.d/02_setup_dbca.sh b/ckan/docker-entrypoint.d/02_setup_dbca.sh index c2564cb3..7b2196dd 100644 --- a/ckan/docker-entrypoint.d/02_setup_dbca.sh +++ b/ckan/docker-entrypoint.d/02_setup_dbca.sh @@ -3,8 +3,6 @@ ## Create logs folder/files and set permissions mkdir -p $APP_DIR/logs touch $APP_DIR/logs/ckan.log -touch $APP_DIR/logs/ckan-worker.log -touch $APP_DIR/logs/ckan-crons-jobs.log chown -R ckan:ckan $APP_DIR/logs ## Create archive folder and set permissions diff --git a/ckan/setup/dbca_ckan_cron_jobs b/ckan/setup/dbca_ckan_cron_jobs index e888624e..c25ee32b 100644 --- a/ckan/setup/dbca_ckan_cron_jobs +++ b/ckan/setup/dbca_ckan_cron_jobs @@ -1,6 +1,4 @@ # Crontab for CKAN cron jobs -# Midnight task to rotate CKAN app logs every day -0 0 * * * /usr/sbin/logrotate -s /srv/app/logs/logrotate.status /etc/logrotate.d/dbca_ckan_rotate_logs # Example cron job runs the harvester run command every 15 mins #*/15 * * * * /usr/bin/ckan -c /srv/app/config/dbca.ini harvester run # 8am task to schedule embargo datasets to public visibility diff --git a/ckan/setup/dbca_ckan_rotate_logs b/ckan/setup/dbca_ckan_rotate_logs deleted file mode 100644 index f1af6a96..00000000 --- a/ckan/setup/dbca_ckan_rotate_logs +++ /dev/null @@ -1,10 +0,0 @@ -/srv/app/logs/ckan-worker.log /srv/app/logs/ckan-crons-jobs.log { - su ckan ckan - daily - rotate 7 - missingok - notifempty - compress - delaycompress - copytruncate -} \ No newline at end of file diff --git a/ckan/supervisor/ckan_cron_jobs.conf b/ckan/supervisor/ckan_cron_jobs.conf index ed5e3fa9..ca3de39a 100644 --- a/ckan/supervisor/ckan_cron_jobs.conf +++ b/ckan/supervisor/ckan_cron_jobs.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan-crons-jobs.log +stderr_logfile=/srv/app/logs/ckan.log ; Make sure that the worker is started on system start and automatically diff --git a/ckan/supervisor/ckan_worker_bulk.conf b/ckan/supervisor/ckan_worker_bulk.conf index b79065c1..cf513309 100644 --- a/ckan/supervisor/ckan_worker_bulk.conf +++ b/ckan/supervisor/ckan_worker_bulk.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan-worker.log +stderr_logfile=/srv/app/logs/ckan.log ; Make sure that the worker is started on system start and automatically diff --git a/ckan/supervisor/ckan_worker_default.conf b/ckan/supervisor/ckan_worker_default.conf index 354bfc1b..3e2ccd19 100644 --- a/ckan/supervisor/ckan_worker_default.conf +++ b/ckan/supervisor/ckan_worker_default.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan-worker.log +stderr_logfile=/srv/app/logs/ckan.log ; Make sure that the worker is started on system start and automatically diff --git a/ckan/supervisor/ckan_worker_priority.conf b/ckan/supervisor/ckan_worker_priority.conf index 195ad982..0c73f6ab 100644 --- a/ckan/supervisor/ckan_worker_priority.conf +++ b/ckan/supervisor/ckan_worker_priority.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan-worker.log +stderr_logfile=/srv/app/logs/ckan.log ; Make sure that the worker is started on system start and automatically