Updated on 2024-03-22 GMT+08:00

Collecting Logs from Nginx

This section describes the Nginx access log structuring template details.

Structuring Template Details

  • Nginx log example
    Table 1 Structuring template example

    Template Name

    Example Log

    NGINX

    192.168.1.101 - [27/Aug/2018:14:20:29 +0800] "GET http://www.example.com / HTTP/1.0" 200 8796 6775 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36" "-" "0.185" "0.010" 12.129.120.121:8090 200 794
  • Structuring fields and description
    Table 2 Structuring fields

    Field

    Example

    Description

    Type

    body_bytes_sent

    6775

    Size of the file body sent to the client

    long

    bytes_sent

    8796

    Response size

    long

    host

    www.example.com

    Domain name

    string

    http_referer

    -

    Source page URL

    string

    http_user_agent

    Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36

    Client browser information

    string

    http_x_forwarded_for

    -

    Actual IP address of the client

    string

    remote_addr

    192.168.1.101

    Client address

    string

    remote_user

    -

    Username of the remote client

    string

    request_length

    794

    Request length

    long

    request_method

    GET

    Request method

    string

    request_time

    0.185

    Time when a request was sent

    float

    request_uri

    /

    URL of the request

    string

    scheme

    http

    HTTP or HTTPS

    string

    server_protocol

    HTTP/1.0

    Request protocol

    string

    status

    200

    Response status code

    long

    time_local

    27/Aug/2018:14:20:29

    Date

    string

    upstream_addr

    12.129.120.121:8090

    Backend server address

    string

    upstream_response_time

    0.010

    Backend server response time

    float

    upstream_status

    200

    Backend server response status

    long