Clarify Nginx JSON log migration instructions
This commit is contained in:
parent
e4148de161
commit
528dc4362d
1 changed files with 8 additions and 2 deletions
10
README.md
10
README.md
|
|
@ -18,7 +18,7 @@ Bulma and Chart.js are vendored under `app/static/vendor`, so the dashboard does
|
|||
|
||||
## Nginx log format
|
||||
|
||||
Add the dedicated log (the application does not change Nginx configuration):
|
||||
Add the dedicated log inside Nginx's `http` block (the application does not change Nginx configuration):
|
||||
|
||||
```nginx
|
||||
log_format traffic_json escape=json
|
||||
|
|
@ -32,7 +32,13 @@ log_format traffic_json escape=json
|
|||
access_log /var/log/nginx-traffic/traffic.log traffic_json;
|
||||
```
|
||||
|
||||
For an existing installation, deploy the updated dashboard first, then replace the dedicated log format and its `access_log` directive, run `sudo nginx -t`, and reload with `sudo systemctl reload nginx`. The parser supports mixed JSON and original whitespace records during migration. Original records still contribute to the table but display “Unavailable” for client address and path. No historical logs are replayed.
|
||||
For an existing installation, deploy the updated dashboard first, then replace the dedicated log format and its `access_log` directive. This JSON format is already supported by the application; no parser changes are needed. Validate the configuration and reload only if validation succeeds:
|
||||
|
||||
```sh
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
The parser supports mixed JSON and original whitespace records during migration, including original records without upstream timing. Original records still contribute to the table but display “Unavailable” for client address and path. New fields appear on newly completed requests after the reload; existing rows and an already-open overlay retain their original details. Upstream timing displays “—” when unavailable, even with the new format. No historical logs are replayed.
|
||||
|
||||
The client address is Nginx's `$remote_addr`. Behind a proxy, it may be the proxy address unless trusted real-IP handling is already configured in Nginx. The path is normalized `$uri`, which can reflect rewrites; query parameters, headers, and request bodies are not captured. All JSON values in this format are strings, including numeric fields.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue