Example Analysis based on nginx access Log format
This article is about sample analysis based on nginx access log format. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
In the nginx.cnf of nginx, use the log_format field to specify the format file of the log.
Log.fromat:
Log_format access'[$time_local] | $host | $remote_addr | $request | $request_time | $body_bytes_sent | $status |'| $upstream_addr | $upstream_response_time | $upstream_status |'"$http_referer" | "$http_user_agent"'
The fields correspond to:
Time_local local timestamp
Host request host address
Remote_addr remote request address
Request request uri
Total time of request_time for the entire request
Body_bytes_sent request file content size
Status http request status
The address of the service provided by the upstream_addr backend (that is, the destination address for forwarding processing)
Response time of upstream when upstream_reponse_time request
Upstream_status upstream statu
Http_refer url jump source
UserAgent of http_user_agent user terminal browser
For example
[18/Feb/2017:19:16:59 + 0800] | test.xyz | 115.33.60.172 | POST / api/1.1/device/info HTTP/1.1 | 0.003 | 43 | 200 | 127.0.0.1 POST 6000 | 0.003 | "-" | "Apache-HttpClient/UNAVAILABLE (java 1.4)"
Therefore, according to the log of access, we can judge the status of the request and the amount of data requested, and according to the target address, we can judge whether the forwarding rule of nginx is configured successfully.
Thank you for reading! This is the end of this article on "sample Analysis based on nginx access Log format". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!