mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-09-24 13:40:19 +01:00
Nginx Proxy Manager had no way to inspect application or nginx logs from the web UI - admins had to shell into the container or read `docker logs`. This adds an admin-only Logs page that can tail: - the backend application log, now also mirrored to /data/logs/backend.log (in addition to stdout) and rotated by the logrotate timer that already runs every 2 days - the Let's Encrypt/certbot log, which certbot already writes to /data/logs/letsencrypt.log via its existing --logs-dir flag - per-host nginx access/error logs (proxy, redirection, 404 and stream hosts), with the file path always resolved server-side from a validated host_type enum + numeric host_id, never from client input Reads use a reverse chunked scan (64KB chunks, capped at 5MB scanned per request) instead of loading whole files into memory, and the frontend polls every 5s only while the tab is focused and "Live" is on, so this stays cheap on both CPU and memory. No new runtime dependencies were added on either side. Purely additive: two new admin-only endpoints (GET /api/logs/sources, GET /api/logs/tail), no existing behaviour changed.
70 lines
1.3 KiB
JSON
70 lines
1.3 KiB
JSON
{
|
|
"type": "object",
|
|
"description": "Available log sources for the log viewer",
|
|
"required": ["system", "letsencrypt", "hosts"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"system": {
|
|
"type": "object",
|
|
"properties": {
|
|
"label": {
|
|
"type": "string",
|
|
"example": "System"
|
|
}
|
|
}
|
|
},
|
|
"letsencrypt": {
|
|
"type": "object",
|
|
"properties": {
|
|
"label": {
|
|
"type": "string",
|
|
"example": "Let's Encrypt"
|
|
}
|
|
}
|
|
},
|
|
"hosts": {
|
|
"type": "object",
|
|
"required": ["proxy", "redirection", "dead", "stream"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"proxy": {
|
|
"$ref": "#/$defs/host-option-list"
|
|
},
|
|
"redirection": {
|
|
"$ref": "#/$defs/host-option-list"
|
|
},
|
|
"dead": {
|
|
"$ref": "#/$defs/host-option-list"
|
|
},
|
|
"stream": {
|
|
"$ref": "#/$defs/host-option-list"
|
|
}
|
|
},
|
|
"example": {
|
|
"proxy": [{ "id": 1, "label": "example.com" }],
|
|
"redirection": [],
|
|
"dead": [],
|
|
"stream": [{ "id": 1, "label": "Port 5432 → 10.0.0.5:5432" }]
|
|
}
|
|
}
|
|
},
|
|
"$defs": {
|
|
"host-option-list": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["id", "label"],
|
|
"properties": {
|
|
"id": {
|
|
"$ref": "../common.json#/properties/id"
|
|
},
|
|
"label": {
|
|
"type": "string",
|
|
"example": "example.com"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|