View the Apache server error log on a Linux system _linux

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

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

This article will 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 default location for the system-wide Apache error log is/var/log/apache2/error.log. The default location can be modified by editing the Apache configuration file.
Custom error Log

To locate a custom error log location, open/etc/apache2/apache2.conf with a text editor, and then locate the row that starts with ErrorLog, which specifies the location of the custom Apache error log file. For example, the following lines can be found in the unmodified Apache configuration file:

  ErrorLog ${apache_log_dir}/error.log

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

  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 on the Apache Web server, the ERRORLOG directive may be specified within the Virtual host container, in which case the system-wide error log location described above will be ignored.

When a virtual host is 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 the/etc/apache2/sites-enabled/.conf and look for the ErrorLog instruction, which displays the error log file specified by the site.
Apache error log location on Centos,fedora or Rhel
Default error log

In Linux based on Red Hat, the system-wide Apache error log files are placed by default in/var/log/httpd/error_log. This default location can be customized by modifying the Apache configuration file.
Custom error Log

To find the custom location for the Apache error log, open/etc/httpd/conf/httpd.conf with a text editor, and then look for ServerRoot, which shows the top level of the Apache WEB Server directory tree. Both the log file and configuration are located in the directory tree. For example:

  ServerRoot "/ETC/HTTPD"

Now, find the line at the beginning of 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:

  ErrorLog "Log/error_log"

With the two instructions above, you get the full error log path, which is/etc/httpd/logs/errorlog by default. In the newly installed Apache, this is a symbolic link to the/var/log/httpd/errorlog.

In reality, ErrorLog may point to any location in 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 a virtual host). Find ErrorLog in the standalone Virtual host section. For example, in the following virtual host section, the location of the error log is/var/www/xmodulo.com/logs/error_log.

  <virtualhost *:80>
    ServerAdmin webmaster@xmodulo.com
    documentroot/var/www/xmodulo.com/public_html
    ServerName www.xmodulo.com
    Serveralias xmodulo.com
    errorlog/var/www/xmodulo.com/logs/error_log
    customlog/var/www/xmodulo.com/logs/ Access_log
  <VirtualHost>

Related Article

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.