fooinha / nginx-json-log

Highly configurable JSON format logging per Location - nginx logging module - aka. kasha 🍲
BSD 2-Clause "Simplified" License
42 stars 21 forks source link

ngx-http-log-json: variables #8

Closed fooinha closed 7 years ago

fooinha commented 7 years ago

module: variable $http_log_json_req_headers;

Creates a json object with all request headers.

Example:

"req": {
    "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.52.1",
        "Accept": "*/*"
    }
}

module: variable $http_log_json_req_body;

Log request body encoded as base64. It requires proxy_pass configuration at logging location.

Example:

"req": {
    "body": "Zm9v"
}

module: location directive http_log_json_req_body_limit 512;

Default limit is 512 bytes.

Argument is a size string. May be 1k or 1M, but avoid this!


module: variable $http_log_json_resp_headers;

Creates a json object with available response headers.

Example:

```
resp": {
"headers": {
  "Last-Modified": "Sat, 01 Apr 2017 13:34:28 GMT",
  "ETag": "\"58dfac64-12\"",
  "X-Foo": "bar",
  "Accept-Ranges": "bytes"
}
```