Apache Configuration Access Log

Source: Internet
Author: User

1. Define the log format in the master configuration file

[Email protected] ~]# vim/usr/local/apache2/conf/httpd.conf
<ifmodule log_config_module> Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" Combin Ed # Default defined log format, combined is the log format name logformat "%h%l%u%t \"%r\ "%>s%b" common # Default defined log format, C Ommon is a log format name </IfModule>

2. Apply the log format in the virtual host configuration file

[Email protected] ~]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf<virtualhost *:80>    DocumentRoot "/data/www"    ServerName www.test.com    errorlog "Logs/test.com_error_log" Customlog "Logs/test.com_                   Access_log "Combined    # apply combined format log here  </VirtualHost>

3. Reload the configuration file, visit the site and see if the log is generated

[Email protected] ~]#/usr/local/apache2/bin/apachectl-~]#/usr/local/apache2/bin/~]# ls/usr/ local/apache2/logs/    # generates the following two logs access_log  error_log  httpd.pid  test.com_ Access_log  test.com_error_log 

Apache Configuration Access Log

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.