mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
limit logs size with logrotate
This commit is contained in:
parent
694a885597
commit
48ac238f5b
@ -21,6 +21,9 @@ install()
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ufw
|
||||
systemctl disable ufw
|
||||
|
||||
# Disable logging to kernel
|
||||
grep -q maxsize /etc/logrotate.d/ufw || sed -i /weekly/amaxsize2M /etc/logrotate.d/ufw
|
||||
}
|
||||
|
||||
configure()
|
||||
|
||||
13
ncp.sh
13
ncp.sh
@ -184,6 +184,19 @@ EOF
|
||||
# update to latest version from github as part of the build process
|
||||
bin/ncp-update $BRANCH
|
||||
|
||||
# LIMIT LOG SIZE
|
||||
grep -q maxsize /etc/logrotate.d/apache2 || sed -i /weekly/amaxsize2M /etc/logrotate.d/apache2
|
||||
cat >> /etc/logrotate.d/ncp <<'EOF'
|
||||
/var/log/ncp.log
|
||||
{
|
||||
rotate 4
|
||||
size 500K
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
}
|
||||
EOF
|
||||
|
||||
# ONLY FOR IMAGE BUILDS
|
||||
if [[ -f /.ncp-image ]]; then
|
||||
rm -rf /var/log/ncp.log
|
||||
|
||||
17
update.sh
17
update.sh
@ -216,7 +216,6 @@ Package: *
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 600
|
||||
EOF
|
||||
|
||||
apt-get update
|
||||
|
||||
apt-get purge -y php7.0-*
|
||||
@ -288,6 +287,22 @@ EOF
|
||||
URL="$(ncc config:system:get overwrite.cli.url)"
|
||||
[[ "${URL: -1}" != "/" ]] && ncc config:system:set overwrite.cli.url --value="${URL}/"
|
||||
|
||||
# Implement logrotate restrictions
|
||||
grep -q "^\& stop" /etc/rsyslog.d/20-ufw.conf || echo "& stop" >> /etc/rsyslog.d/20-ufw.conf
|
||||
grep -q maxsize /etc/logrotate.d/ufw || sed -i /weekly/amaxsize2M /etc/logrotate.d/ufw
|
||||
grep -q maxsize /etc/logrotate.d/apache2 || sed -i /weekly/amaxsize2M /etc/logrotate.d/apache2
|
||||
service rsyslog restart
|
||||
cat >> /etc/logrotate.d/ncp <<'EOF'
|
||||
/var/log/ncp.log
|
||||
{
|
||||
rotate 4
|
||||
size 500K
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
}
|
||||
EOF
|
||||
|
||||
} # end - only live updates
|
||||
|
||||
exit 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user