当前位置: 动力学知识库 > 问答 > 编程问答 >

logging - apache error log backup auto

问题描述:

This is my first question. I don't know how to config error.log has 2 function as below:

  1. The log generated by current day will output to one fixed name log file. e.g error.log. This current log contains the current generated log only.
  2. The previous log will back-up to single log file. e.g:

    yesterday is 11/22/2013, so the error log of yesterday is named 11_22_2013.error.log

网友答案:

You can make use of the rotatelogs command to log rotate the apache logs. Try to put the following as a crontab.

crontab -e

Add the following there.

/usr/local/apache/bin/rotatelogs /path_to_apachelogs.%Y.%m.%d 86400

/usr/local/apache/bin/rotatelogs This path is meant for a cPanel server. You needed to give the full path for it to work. You can use the following command for getting the path.

which rotatelogs

If this is not showing any outputs, Try to locate the path with the locate command.

You can have further awareness from the following link

分享给朋友:
您可能感兴趣的文章:
随机阅读: