Nginx access log and error log parameter description

Nginx access log and error log parameter description

illustrate:

There are two main types of nginx logs: access logs and error logs. The access log records every request from the client to access nginx, including information such as user geographical origin, jump source, terminal used, number of visits to a certain URL, etc. The access log format can be customized; the error log records the log when an error occurs when the client accesses nginx. The format does not support customization. Through the error log, you can get the performance bottleneck of a certain service or server in the system. Both logs can be disabled selectively.

Access log [Access.log]

log_format main '$remote_addr $remote_user [$time_local] "$request" $http_host '
'$status $upstream_status $body_bytes_sent “$http_referer” '
'"$http_user_agent" $ssl_protocol $ssl_cipher $upstream_addr '
'$request_time $upstream_response_time';

Variable Name

Variable Description

Example

$remote_addr

Client Address

113.140.15.90

$remote_user

Client User Name

$time_local

Access time and time zone

18/Jul/2012:17:00:01 +0800

$request

Request URI and HTTP protocol

"GET /pa/img/home/logo-alipay-t.png HTTP/1.1"

$http_host

Request address, which is the address you enter in the browser (IP or domain name)

img.alipay.com

10.253.70.103

$status

HTTP Request Status

200

$upstream_status

Upstream Status

200

$body_bytes_sent

The size of the file sent to the client

547

$http_referer

Jump source

“https://cashier.alipay.com…/”

$http_user_agent

User terminal agent

"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; GTB7.0; .NET4.0C;

$ssl_protocol

SSL protocol version

TLSv1

$ssl_cipher

Algorithms in Exchange Data

RC4-SHA

$upstream_addr

The address of the background upstream, that is, the address of the host that actually provides the service

10.228.35.247:80

$request_time

The total time of the entire request

0.205

$upstream_response_time

Upstream response time during the request process

0.002

Online example:

116.9.137.90 – [02/Aug/2012:14:47:12 +0800] “GET /images/XX/20100324752729.png HTTP/1.1″img.alipay.com 200 200 2038 https://cashier.alipay.com/XX/PaymentResult.htm?payNo=XX&outBizNo=2012XX “Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; 360SE)” TLSv1 AES128-SHA 10.228.21.237:80 0.198 0.001

Offline test ($http_referer):

10.14.21.197 – – [14/Aug/2012:17:28:22 +0800] “GET /spanner/watch/v1?–db=ztg-1&–mode=compare&–index=status&–option=&–cluster=whole&-F=2012%2F8%2F12-00%3A00%3A00&-T=%2B2880&-i=1&-n=0&_=1344936501292 HTTP/1.1” 200 94193 “http://spanner.alipay.net/optionFrame/history.html” “Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.60 Safari/537.1”

Note: $http_referer is related to redirection.

Error log [Error.log]

error message Error Description
“upstream prematurely closed connection” The exception that occurs when requesting the URI is caused by the user disconnecting before the upstream returns a response to the user. It has no impact on the system and can be ignored.
"recv() failed (104: Connection reset by peer)" (1) The number of concurrent connections to the server exceeds its capacity, and the server will shut down some of the connections. (2) The client closes the browser, but the server is still sending data to the client. (3) The browser presses the Stop button.
“(111: Connection refused) while connecting to upstream” When connecting, if the backend upstream fails or is disconnected, the user will receive this error
"(111: Connection refused) while reading response header from upstream" When users read data after a successful connection, if the backend upstream fails or is disconnected, they will receive this error
“(111: Connection refused) while sending request to upstream” When Nginx sends data after successfully connecting to the upstream, if the backend upstream is down or unreachable, you will receive this error
“(110: Connection timed out) while connecting to upstream” Nginx timed out when connecting to the subsequent upstream
“(110: Connection timed out) while reading upstream”

Nginx timed out while reading response from upstream

“(110: Connection timed out) while reading response header from upstream” Nginx timed out while reading response header from upstream
“(110: Connection timed out) while reading upstream” Nginx timed out while reading response from upstream
“(104: Connection reset by peer) while connecting to upstream” Upstream sends RST, resetting the connection
"upstream sent invalid header while reading response header from upstream" The response header sent by upstream is invalid
"upstream sent no valid HTTP/1.0 header while reading response header from upstream" The response header sent by upstream is invalid
"client intended to send too large body" Used to set the maximum value of the client request content allowed to be accepted. The default value is 1M. The body sent by the client exceeds the set value.
“reopening logs” The user sends the kill -USR1 command
"gracefully shutting down", User sends the kill -WINCH command
“no servers are inside upstream” Server is not configured under upstream
“no live upstreams while connecting to upstream” All upstream servers are down
"SSL_do_handshake() failed" SSL handshake failed
"SSL_write() failed (SSL:) while sending to client"
"(13: Permission denied) while reading upstream"
“(98: Address already in use) while connecting to upstream”
“(99: Cannot assign requested address) while connecting to upstream”
"ngx_slab_alloc() failed: no memory in SSL session shared cache" Caused by insufficient ssl_session_cache size and other reasons
“could not add new SSL session to the session cache while SSL handshaking” Caused by insufficient ssl_session_cache size and other reasons
"send() failed (111: Connection refused)"

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to read and analyze Nginx error logs using NodeJS
  • How to configure PHP error log when using PHP-FPM in Nginx
  • Configuring Nginx access and error logs

<<:  MySQL 5.5.27 winx64 installation and configuration method graphic tutorial

>>:  How to generate PDF and download it in Vue front-end

Recommend

Process analysis of deploying ASP.NET Core applications on Linux system Docker

Table of contents 1. System environment 2. Operat...

Detailed steps to install Hadoop cluster under Linux

Table of contents 1. Create a Hadoop directory in...

JavaScript to implement slider verification code

This article shares the specific code of JavaScri...

MySQL index knowledge summary

The establishment of MySQL index is very importan...

The principle and implementation of two-way binding in Vue2.x

Table of contents 1. Implementation process 2. Di...

How to use JSX in Vue

What is JSX JSX is a syntax extension of Javascri...

A MySQL migration plan and practical record of pitfalls

Table of contents background Solution 1: Back up ...

Appreciation of the low-key and elegant web design in black, white and gray

Among classic color combinations, probably no one...

MySQL slow query pitfalls

Table of contents 1. Slow query configuration 1-1...

Solve the problem of OpenLayers 3 loading vector map source

1. Vector Map Vector graphics use straight lines ...

MySQL sharding details

1. Business scenario introduction Suppose there i...