From 83988ea1da37080a1cc3025b4245617fbb9c907c Mon Sep 17 00:00:00 2001 From: KwadFan <43513802+KwadFan@users.noreply.github.com> Date: Wed, 19 Jan 2022 23:51:09 +0100 Subject: [PATCH] feat: changed logging and logrotate behavior (#79) Disabled logging for 'webcam*' nginx proxy Changed nginx logrotate 'rotate' from 14 to 2 Changed webcamd logging, rotate 2 and limit to 32M Changed rsyslog logrotate 'rotate' from 4 to 2 and limit from 256M to 128M and daily instead of weekly Signed-off-by: Stephan Wendel --- .../mainsail/filesystem/root/etc/logrotate.d/rsyslog | 10 +++++----- .../filesystem/root/etc/nginx/sites-available/mainsail | 8 ++++++++ src/modules/mainsail/start_chroot_script | 3 +++ .../filesystem/root/etc/logrotate.d/webcamd | 6 +++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/modules/mainsail/filesystem/root/etc/logrotate.d/rsyslog b/src/modules/mainsail/filesystem/root/etc/logrotate.d/rsyslog index af824897e..74deaa389 100644 --- a/src/modules/mainsail/filesystem/root/etc/logrotate.d/rsyslog +++ b/src/modules/mainsail/filesystem/root/etc/logrotate.d/rsyslog @@ -1,8 +1,8 @@ /var/log/syslog { - rotate 4 + rotate 2 daily - maxsize 256M + maxsize 128M missingok notifempty delaycompress @@ -25,9 +25,9 @@ /var/log/debug /var/log/messages { - rotate 4 - weekly - maxsize 256M + rotate 2 + daily + maxsize 128M missingok notifempty compress diff --git a/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail b/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail index 30f0beeca..d06dde3a0 100644 --- a/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail +++ b/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail @@ -58,17 +58,25 @@ server { location /webcam/ { proxy_pass http://mjpgstreamer1/; + access_log off; + error_log off; } location /webcam2/ { proxy_pass http://mjpgstreamer2/; + access_log off; + error_log off; } location /webcam3/ { + access_log off; + error_log off; proxy_pass http://mjpgstreamer3/; } location /webcam4/ { + access_log off; + error_log off; proxy_pass http://mjpgstreamer4/; } } diff --git a/src/modules/mainsail/start_chroot_script b/src/modules/mainsail/start_chroot_script index 10dbe75ea..cf792b474 100644 --- a/src/modules/mainsail/start_chroot_script +++ b/src/modules/mainsail/start_chroot_script @@ -29,6 +29,9 @@ apt update && apt install ${MAINSAIL_DEPS} -y rm /etc/nginx/sites-enabled/default ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/ +# lower nginx rotate cycle to 2 instead 14 +sudo sed -i 's/rotate 14/rotate 2/' /etc/logrotate.d/nginx + ### Download and Install Mainsail Web Frontend pushd /home/${BASE_USER} sudo -u ${BASE_USER} wget -q --show-progress -O mainsail.zip "${MAINSAIL_URL}" diff --git a/src/modules/mjpgstreamer/filesystem/root/etc/logrotate.d/webcamd b/src/modules/mjpgstreamer/filesystem/root/etc/logrotate.d/webcamd index bf135d2da..ecd9f7803 100644 --- a/src/modules/mjpgstreamer/filesystem/root/etc/logrotate.d/webcamd +++ b/src/modules/mjpgstreamer/filesystem/root/etc/logrotate.d/webcamd @@ -1,9 +1,9 @@ - + /var/log/webcamd.log { - rotate 4 + rotate 2 weekly - maxsize 64M + maxsize 32M missingok notifempty compress