Apache Log Cutting

Source: Internet
Author: User
Tags apache log

What we're saying here about Apache's log is the thing about the access log! To prevent log files from being too large, we archive the logs on a daily basis!

Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf

Open the virtual machine configuration file and remove the # number in front of the following two lines

Errorlog "Logs/dummy-host2.example.com-error_log" Customlog "Logs/dummy-host2.example.com-access_log" common

Then restart the Apache service and visit some sites to see the generated log files:

[Email protected] logs]# Lsaccess_log error_logdummy-host2.example.com-access_log Httpd.piddumm Y-host2.example.com-error_log

Then start configuring the Cut log file as follows:

Errorlog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/test2.com-error_%y%m%d.log 86400" CustomLog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/test2.com-access_%y%m%d.log 86400" combined

Then look at the log file:

[Email protected] logs]#/usr/local/apache2/bin/apachectl-tsyntax ok[[email protected] logs]#/usr/local/apache2/bin /apachectl Restart[[email protected] logs]# lsaccess_log error_log httpd.pid test2.com-access_20151118.log

For more details on Apache logs, you can view this blog post!

This article is from the "Custom" blog, so be sure to keep this source http://zidingyi.blog.51cto.com/10735263/1714448

Apache Log Cutting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.