Log Rotate

From DISI
Revision as of 00:01, 19 March 2022 by Jgutierrez6 (talk | contribs)
Jump to navigation Jump to search

Introduction

Log Rotation is an automated process used in system administration in which log files are compressed, moved, renamed or deleted once they are too old or too big. New incoming log data is directed into a new fresh file.

Installation

yum update && yum install logrotate

Configuration

  1. Edit the httpd log rotate conf file.
    • vim /etc/logrotate.d/httpd
  2. Delete all default lines and replace with these lines
/var/log/httpd/*log {
        monthly
        rotate 3
        size=10M
        compress
        missingok
        notifempty
	dateext
	dateformat -%m%d%Y
	sharedscripts
	postrotate
		/root/scp_logs.sh
        	/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
	endscript
}

/var/log/httpd/*/*log {
        monthly
	rotate 3
	size=10M
	compress
	missingok
	notifempty
	dateext
        dateformat -%m%d%Y
	sharedscripts
	postrotate
		/root/scp_logs.sh
		/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    	endscript
}

Rsync Script