[[email protected] ~]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf (Save the following # two files)
Errorlog "Logs/dummy-host.example.com-error_log"
Customlog "Logs/dummy-host.example.com-access_log" combined
Common Primary log file
[Email protected] ~]# vim/usr/local/apache2/conf/httpd.conf
[Email protected] ~]# ls/usr/local/apache2/logs/
Access_log Error_log Httpd.pid
[Email protected] ~]#/usr/local/apache2/bin/apachectl Graceful
[Email protected] ~]# cd/usr/local/apache2/logs/
[[email protected] logs]# ls
Access_log dummy-host.example.com-access_log Dummy-host.example.com-error_log error_log httpd.pid
[[email protected] logs]# cat dummy-host.example.com-access_log (View access log)
Log Cutting
[Email protected] ~]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Errorlog "Logs/test.com-error_log"
Customlog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/test.com-access_%y%m%d_log 86400" combined
Syntax OK
[Email protected] ~]#/usr/local/apache2/bin/apachectl restart
[[email protected] logs]# ls
Access_log Dummy-host.example.com-error_log httpd.pid Test.com-error_log
Dummy-host.example.com-access_log Error_log Test.com-access_20160315_log
[[email protected] logs]# date-s "2016-03-16 01:01:00"
Wednesday, March 16, 2016 01:01:00 CST
[[email protected] logs]# ls
Access_log Dummy-host.example.com-error_log httpd.pid test.com-access_2016031 6_log
Dummy-host.example.com-access_log error_log Test.com-access_20160315_log Test.com-error_log
This article is from the "Mr Guo" blog, so be sure to keep this source http://490617581.blog.51cto.com/7223113/1751102
Apache Log Cutting