Clean up apache logs

I came to the company in the morning and found that the website was down. To be precise, the database should be down.

Thinking that mysql was abnormal, I was about to restart mysql, and found the prompt ERROR! Manager of pid-file quit without updating file

After looking for various solutions, it doesn't feel right. Looking at the system space one by one, I found that there is still 40% of the mount disk remaining, but the system disk is already slow. I feel that a problem has been found, and continue to find the problem.

Du -ch found that the apache folder was a bit abnormal, and gradually eliminated the logs and found that the number of logs files has been n g. . It seems that my predecessors did not do log segmentation. . Delete the log files one by one, configure the httpd.conf file to split the log, and restart.

everything resolved. .

Step du -ch to view the occupied space of all files and find the logs folder of the target apache

Delete the apache_access.log and access.log files in the apache logs directory. (Actually, restarting httpd at this point is ok)

Configure apache log splitting

  1. ErrorLog "logs/apache_error.log"  
  2. CustomLog "logs/access.log" common  

change into

ErrorLog "|../bin/rotatelogs  logs/apache_error-%Y-%m-%d.log 1M"  

CustomLog "|../bin/rotatelogs local/access_%Y%m%d.log 86400 480" common

Then save and restart httpd service httpd restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325940565&siteId=291194637