Nginx Module Development (18)-Log analysis

Source: Internet
Author: User
Tags connection reset

1. Introduction to the log

There are two main types of Nginx logs: Access logs and error logs. The access log mainly records each request that the client accesses Nginx, the format can be customized; the error log mainly records the log when the client accesses Nginx error, and the format does not support customization. Both types of logs can be selectively closed.

Through the access log, you can get the user's geographical source, jump source, use terminal, a URL to visit the amount of relevant information, through the error log, you can get the system a service or server performance bottleneck. So make good use of the logs and you can get a lot of valuable information.

2. 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

Examples Show

$remote _addr

Client Address

1.1.1.1

$remote _user

Client User Name

-

$time _local

Access time and time zone

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

$request

URI and HTTP Protocol for the request

"Get/xx http/1.1"

$ Http_host

request address, which is the address you entered in the browser ( ip or domain name)

hello.world . com

2.2.2.2

$status

HTTP Request Status

200

$upstream _status

Upstream status

200

$body _bytes_sent

Send to client file content size

547

$http _referer

Jump Source

"https://hello.cj.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 the exchange of data

Rc4-sha

$upstream _addr

The address of the backend upstream , which is the host address that really provides the service

3.3.3.3:80

$request _time

Total time for the entire request

0.205

$upstream _response_time

Upstream response time during the request

0.002

On-line examples:

1.1.1.1-[02/aug/2012:14:47:12 +0800] "get/images/xx/20100324752729.png http/1.1" hello.world.com-2038https:// Hello.cj.com/xx/paymentresult.htm "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 3.3.3.3:80 0.198 0.001

3. Error log

Error message

Error description

"upstream Prematurely (premature) closed connection "

"recv () Failed (104:connection reset by Peer) "

(< Span style= "font-family: ' Times New Roman ';" >1 ) The number of concurrent connections to the server exceeds its capacity, and the server down off; &NBSP;

(2 ) The client has turned off the browser and the server is sending data to the client; Span lang= "en-US" >&NBSP;

( 3 ) browser-side pressed stop

"(111:connection refused) while connecting to upstream"

The user will receive this error if he or she encounters a backend upstream hangs or is not connected.

"(111:connection refused) while reading response headers from upstream"

When the user reads the data after the connection is successful, it will receive the error if the backend upstream hangs or does not pass.

"(111:connection refused) while sending request to upstream"

Nginx and upstream send data after successful connection, if you encounter the backend upstream hangs or does not pass, you will receive this error

"(110:connection timed out) while connecting to upstream"

upstream timeout after nginx connection

"(110:connection timed out) while reading upstream"

Nginx reads a response from upstream time-out

"(110:connection timed out) while reading response headers from upstream"

Nginx timed out when reading a response header from upstream

"(110:connection timed out) while reading upstream"

Nginx reads a response from upstream time-out

"(104:connection reset by peer) and connecting to upstream"

upstream sends the RSTto reset the connection

"Upstream sent invalid header while reading response headers from upstream"

Invalid response header sent by upstream

"Upstream sent no valid http/1.0 header while reading response headers from upstream"

Invalid response header sent by upstream

"Client intended to send too large body"

Used to set the maximum allowed client request content, the default value is 1M, theclient sends more body than the set value

"Reopening logs"

User sends KILL-USR1 command

"Gracefully shutting down",

User sends kill-winch command

"No servers is inside upstream"

Server not configured under upstream

"No live upstreams while connecting to upstream"

The servers under upstream are all hung up.

"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) and connecting to upstream"

"(99:cannot assign requested address) while connecting to upstream"

"Ngx_slab_alloc () Failed:no memory in SSL session shared cache"

Ssl_session_cache size is not enough to cause

"Could not add new SSL session to the session ' cache while SSL handshaking"

Ssl_session_cache size is not enough to cause

"Send () failed (111:connection refused)"

 

 

Nginx Module Development (18)-Log analysis

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.