[Solved] Error log huge
-
- Posts: 14
- Joined: Fri Jul 25, 2014 5:03 am
[Solved] Error log huge
i don't know why my error log gets so big i have to remove it each week or else the site does not work,
- in the pic its 461 GB big
is there a way of disabling error log or limiting it to max 100mb

is there a way of disabling error log or limiting it to max 100mb
Last edited by vandread911 on Thu May 14, 2015 5:33 pm, edited 1 time in total.
Re: Error log huge
Edit your apache/nginx in /etc/logrotate.d/ and add size option.
According to manpage:
According to manpage:
Example (do not copy this!)minsize size
Log files are rotated when they grow bigger than size bytes,
but not before the additionally specified time interval (daily,
weekly, monthly, or yearly). The related size option is simi-
lar except that it is mutually exclusive with the time interval
options, and it causes log files to be rotated without regard
for the last rotation time. When minsize is used, both the
size and timestamp of a log file are considered.
size size
Log files are rotated only if they grow bigger then size bytes.
If size is followed by k, the size is assumed to be in kilo-
bytes. If the M is used, the size is in megabytes, and if G is
used, the size is in gigabytes. So size 100, size 100k, size
100M and size 100G are all valid.
maxsize size
Log files are rotated when they grow bigger than size bytes even before
the additionally specified time interval (daily, weekly, monthly,
or yearly). The related size option is similar except that it
is mutually exclusive with the time interval options, and it causes
log files to be rotated without regard for the last rotation time.
When maxsize is used, both the size and timestamp of a log file are
considered.
Code: Select all
/var/log/httpd/error.log {
rotate 5
mail [email protected]
size 100k
sharedscripts
postrotate
/usr/bin/killall -HUP httpd
endscript
}
-
- Posts: 14
- Joined: Fri Jul 25, 2014 5:03 am
Re: Error log huge
skurudo wrote:Edit your apache/nginx in /etc/logrotate.d/ and add size option.
According to manpage:Example (do not copy this!)minsize size
Log files are rotated when they grow bigger than size bytes,
but not before the additionally specified time interval (daily,
weekly, monthly, or yearly). The related size option is simi-
lar except that it is mutually exclusive with the time interval
options, and it causes log files to be rotated without regard
for the last rotation time. When minsize is used, both the
size and timestamp of a log file are considered.
size size
Log files are rotated only if they grow bigger then size bytes.
If size is followed by k, the size is assumed to be in kilo-
bytes. If the M is used, the size is in megabytes, and if G is
used, the size is in gigabytes. So size 100, size 100k, size
100M and size 100G are all valid.
maxsize size
Log files are rotated when they grow bigger than size bytes even before
the additionally specified time interval (daily, weekly, monthly,
or yearly). The related size option is similar except that it
is mutually exclusive with the time interval options, and it causes
log files to be rotated without regard for the last rotation time.
When maxsize is used, both the size and timestamp of a log file are
considered.Code: Select all
/var/log/httpd/error.log { rotate 5 mail [email protected] size 100k sharedscripts postrotate /usr/bin/killall -HUP httpd endscript }
Within:
Code: Select all
/etc/logrotate.d/httpd
would i have to edit this:/var/log/httpd/*log /var/log/httpd/domains/*log {
missingok
notifempty
compress
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
Code: Select all
missingok
notifempty
compress
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
Code: Select all
rotate 5
mail [email protected]
size 50M
sharedscripts
postrotate
/usr/bin/killall -HUP httpd
endscript
Re: Error log huge
Look nice.vandread911 wrote:if i would like it to rotate when it hits 50Mb
And you can edit apache2.conf and log not all error, but only critical.