View the Apache server's error log on a Linux system

Source: Internet
Author: User
Tags apache error log linux mint

Error logs and access log files provide useful information for system administrators, such as troubleshooting a WEB server, protecting the system against a variety of malicious activities, or simply conducting a variety of analyses to monitor the HTTP server. Depending on your WEB server configuration, the error/access log may be placed in a different location on your system.

This article can help you find the Apache error log on Linux.
Apache error log location on Debian,ubuntu or Linux Mint
Default error log

On Debian-based Linux, the system-wide Apache error log default location is/var/log/apache2/error.log. The default location can be modified by editing the Apache configuration file.
Custom error logs

To find a custom error log location, open/etc/apache2/apache2.conf with a text editor and look for a line that begins with errorlog, which specifies the location of the custom Apache error log file. For example, the following lines can be found in an unmodified Apache configuration file:

?
1 ErrorLog ${APACHE_LOG_DIR}/error.log

In this case, the location is configured with the APACHELOGDIR environment variable, which is already defined in/etc/apache2/envvars.

?
1 export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

In reality, errorlog may point to any path in your Linux system.
Using the virtual host custom error log

If a virtual host is used in the Apache Web server, the errorlog instruction may be specified within the Virtual host container, in which case the system-wide error log location described above will be ignored.

When virtual hosts are enabled, individual virtual hosts can define their own custom error log locations. To find the error log location for a particular virtual host, you can open/etc/apache2/sites-enabled/.conf and look for the errorlog directive, which displays the error log file specified by the site.
Apache error log location on Centos,fedora or Rhel
Default error log

In Red Hat-based Linux, the system-wide Apache error log file is placed by default in/var/log/httpd/error_log. The default location can be customized by modifying the Apache configuration file.
Custom error logs

To find the custom location of the Apache error log, open/etc/httpd/conf/httpd.conf with a text editor and look for ServerRoot, which shows the top level of the Apache Web server tree. The log files and configurations are located in the directory tree. For example:

?
1 ServerRoot "/etc/httpd"

Now, look for the line beginning with errorlog, which indicates where the Apache Web server wrote the error log. Note that the specified position is the relative position of the ServerRoot value. For example:

?
1 ErrorLog "log/error_log"

Combined with the above two instructions, the complete error log path can be obtained, by default the path is/etc/httpd/logs/errorlog. In the newly installed Apache, this is a symbolic link to/var/log/httpd/errorlog.

In reality, errorlog may point to any location on your Linux system.
Using the virtual host custom error log

If you enable a virtual host, you can find the error log location for each virtual host by checking/etc/httpd/conf/httpd.conf (or any other file that defines the virtual host). Locate the errorlog in the standalone Virtual host section. For example, in the following virtual host section, the error log location is/var/www/xmodulo.com/logs/error_log.

?
12345678 <virtualhost *:80> &NBSP;&NBSP; serveradmin [email protected] &NBSP;&NBSP; documentroot/var/www/xmodulo.com/public_html    servername www.xmodulo.com    serveralias xmodulo.com &NBSP;&NBSP; Code class= "Plain Plain" >errorlog/var/www/xmodulo.com/logs/error_log     customlog/var/www/xmodulo.com/logs/access_log <VIRTUALHOST>

To view the Apache server's error log on a Linux system

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.