Page 1 of 1

stop logs file

Posted: Thu Jul 09, 2015 11:57 am
by vestacp89
hi,

how i can remove and stop all logs file like e.g. for each domain who make really big files and kill my hdd ?

Thanks.

Re: stop logs file

Posted: Fri Jul 10, 2015 9:06 am
by skurudo
It's not good idea, but if you like it, do it ;-)
Most size of logs - apache2 and nginx - you can disable those.
There is not one option, but simple way - config file.

/etc/apache2/apache2.conf

Code: Select all

LogLevel crit
and you must comment out any ErrorLog and CustomLog directives in your Apache configuration files

Same way for nginx, replace access_log/error_log in your nginx configuration files

Code: Select all

 access_log  off;
 error_log off;
Once the changes are made, run /etc/init.d/apache2 restart and /etc/init.d/nginx restart for the changes to take effect.

Re: stop logs file

Posted: Fri Jul 10, 2015 9:08 am
by skurudo
Much better way is to use logrotate and limit size of your logs.. look at your /etc/logrotate.d/ folder and edit files to add limits

1 megabyte:

Code: Select all

size 1M
and rotate faster ;-)

Code: Select all

rotate 14

Re: stop logs file

Posted: Wed Nov 11, 2015 10:18 am
by vestacp89
skurudo wrote:Much better way is to use logrotate and limit size of your logs.. look at your /etc/logrotate.d/ folder and edit files to add limits

1 megabyte:

Code: Select all

size 1M
and rotate faster ;-)

Code: Select all

rotate 14

etc/logrotate.conf this ?
my logrotate.conf file content is:

Code: Select all

# see "man logrotate" for details
# rotate log files weekly
weekly

# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
su root syslog

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}

# system-specific logs may be configured here
I need bellow /var/log/btmp add e.g.

Code: Select all

/var/log/apache2/domains/domain.com.error.log {
  missingok
  daily
  create 0660 root root
  rotate 1
  size 2M
}
this is it ? i need run cron ?

Thanks.

Re: stop logs file

Posted: Thu Nov 12, 2015 5:00 pm
by skurudo
vestacp89 wrote: etc/logrotate.conf this ?
my logrotate.conf file content is:
this is it ? i need run cron ?
CentOS?

See this topic, it's pretty full with examples and explanation:
http://stackoverflow.com/questions/2016 ... r-all-logs

Re: stop logs file

Posted: Thu Nov 19, 2015 3:31 pm
by vestacp89
skurudo wrote:
vestacp89 wrote: etc/logrotate.conf this ?
my logrotate.conf file content is:
this is it ? i need run cron ?
CentOS?

See this topic, it's pretty full with examples and explanation:
http://stackoverflow.com/questions/2016 ... r-all-logs
ubuntu 14.04

Re: stop logs file

Posted: Wed Jul 27, 2016 12:32 pm
by skurudo
vestacp89 wrote:
skurudo wrote:
vestacp89 wrote: ubuntu 14.04
/etc/logrotate.d