Skip to content

Instantly share code, notes, and snippets.

@simbalinux
Created July 13, 2018 01:09
Show Gist options
  • Select an option

  • Save simbalinux/7a61af7c327a7949a2d4d8629d67aa5f to your computer and use it in GitHub Desktop.

Select an option

Save simbalinux/7a61af7c327a7949a2d4d8629d67aa5f to your computer and use it in GitHub Desktop.
logrotation configuration
#place this file in /etc/logrotate.d/
/var/log/vhosts/*.log {
su root root
copytruncate
rotate 30
missingok
notifempty
sharedscripts
compress
delaycompress
postrotate
cp -rp /var/log/vhosts/*.log.* /var/www/vhosts/core/log/archive/web0
cp -rp /var/log/vhosts/*.gz /var/www/vhosts/core/log/archive/web0
endscript
}
#once completed saving the above snippet in /etc/logrotate.d add below to ROOT crontab
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 0 * * * logrotate -fv /etc/logrotate.d/rotate_httpd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment