Linux Server access_log log analysis and configuration details (ii)

Source: Internet
Author: User
Tags php script system log

Which folder is the default Nginx/linux log in?

Error.log files and Access.log files that are typically below the xxx.xxx.xxxx.com/home/admin path
Error_log Logs/error.log; #错误日志
Access_log Logs/access.log; #访问日志

1. Access_log Access log access_log is an access log that logs all requests to the Apache server for access, its location and content is controlled by the customlog instruction, and the logformat instruction can be used to simplify the contents and format of the log
2. Error_log error log error_log is the error log, record any error processing request, its location and content is controlled by the errorlog instruction, usually the server error, first to check it, is one of the most important log files.

Through the Apache configuration file, locate the log storage address: [Plain]View PlainCopy print?
    1. Find/-name "httpd.conf"
Locate the profile address, open it, and locate the Apache "Access log" and "error log" address in the inside.
[Plain]View PlainCopyprint?
    1. sudo vi/private/etc/apache2/httpd.conf



My storage address is:/private/var/log/apache2/error_log/private/var/log/apache2/access_log

One. View Apache error logs [Plain]View PlainCopy print?
    1. Tail-f -30 "/private/var/log/apache2/error_log"

[Fri Jan 13 14:32:52 2017] [ERROR] [Client 127.0.0.1] client denied by server configuration:/export/home/live/ap/htdocs/test The first item is the date and time the error occurred, the second is the severity of the error, The loglevel instruction causes only errors that are higher than the specified severity level to be logged, the third is the IP address that caused the error, and thereafter the information itself, in this case, the server denies the client's access. The server uses the file system path instead of the Web path when it logs the file being accessed. The error log contains multiple types of information similar to the example above. In addition, any information that is output to stderr (standard error) in a CGI script is recorded as debug information in the error log intact. Http://apache.chinahtml.com/mod/core.html#loglevel

Two. Similarly, locate the Access_log storage address in the Apache configuration file. [Plain]View PlainCopyprint?
    1. Tail-f -30 "/private/var/log/apache2/access_log"


look at a typical access_log log record:61.155.149.20--[13/jan/2017:15:42:47 +0800] "get/category/db/http/1.1" 200 23225
1). 61.155.149.20This is a request to the Apache server client IP, by default, the first information is only the IP address of the remote host, but if we need Apache to identify the host name, you can set the hostnamelookups to on, not recommended, will greatly reduce the site speed.
2).-This item is blank and uses "-" instead, which is used to record the viewer's identity, which is empty for most browsers.
3).-Also empty, the name that is provided when the browser is authenticated is logged, and most of this is empty.
4). [13/jan/2017:15:42:47 +0800]The fourth item is the time to log the request, in the format [Day/month/year:hour:minute:second Zone], and the last +0800 indicates that the server is in the East eight zone
5). "get/category/db/http/1.1"This is most useful, first of all, it tells us that the server is receiving a GET request, and secondly, the client requests the resource path, third, the client uses the protocol when http/1.1, the entire format is "%m%u%q%H", i.e. "request method/Access Path/protocol"
6).This is a status code, sent back to the client by the server, it tells us whether the client's request is successful, or is redirected, or what kind of error encountered, this value is 200, indicating that the server has successfully responded to the client's request, in general, the value starts with 2 to indicate the success of the request, A 3-beginning indication of redirection, a 4-based indication that there are some errors in the client, and a server-side error that begins with 5.
7). 23225This indicates how many bytes the server sends to the client, and when the log analysis is counted, the bytes are added together to tell how much the server is sending the data in a certain amount of time. This article describes two types of log access under Apache, nginx log Click http://www.cnblogs.com/111testing/p/7119158.html System log: Record system related information: http://blog.csdn.net/ty_hf/article/ Details/55511624apache access log and error log: Http://blog.csdn.net/ty_hf/article/details/55504719nginx access log and error log:/http BLOG.CSDN.NET/TY_HF/ARTICLE/DETAILS/55518070PHP-FPM Slow log: Detect slow PHP script execution: http://blog.csdn.net/ty_hf/article/details /55504172php error log: detecting PHP runtime or user self-logging error log: http://blog.csdn.net/ty_hf/article/details/ 55505262mysql slow log: Record sql:http://blog.csdn.net/ty_hf/article/details/55504172 performance in MySQL server The source of this article:/http blog.csdn.net/ty_hf/article/details/55504719

Linux Server access_log log analysis and configuration details (ii)

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.