Skip to content

Commit 347fe3c

Browse files
committed
Fix status log counting by using dedicated access log file
1 parent c815435 commit 347fe3c

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Example response:
7878
}
7979
```
8080

81-
`/status` is refreshed by a background monitor that reads the access log for cache totals and samples NGINX `stub_status` for connection counters.
81+
`/status` is refreshed by a background monitor that reads `/var/log/nginx/cache-access.log` for cache totals and samples NGINX `stub_status` for connection counters.
8282

8383
**Health Monitoring**: A background process logs warnings when the upstream server becomes unreachable, but the container continues running to serve cached content.
8484

health-monitor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Poll NGINX and the access log to keep /status current while also logging
44
# upstream reachability changes.
55

6-
ACCESS_LOG=${ACCESS_LOG:-/var/log/nginx/access.log}
6+
ACCESS_LOG=${ACCESS_LOG:-/var/log/nginx/cache-access.log}
77
STATUS_FILE=${STATUS_FILE:-/var/run/nginx/status.json}
88
NGINX_STATUS_URL=${NGINX_STATUS_URL:-http://127.0.0.1:8080/__nginx_status}
99
STATUS_POLL_INTERVAL=${STATUS_POLL_INTERVAL:-5}

nginx.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ http {
1717
'$upstream_cache_status $request_time $upstream_response_time';
1818

1919
access_log /dev/stdout cache;
20-
access_log /var/log/nginx/access.log cache;
20+
access_log /var/log/nginx/cache-access.log cache;
2121
error_log /dev/stderr warn;
2222

2323
proxy_cache_path /var/cache/nginx/owlery levels=1:2 keys_zone=owlery_cache:100m max_size=${CACHE_MAX_SIZE} inactive=5y use_temp_path=off;

0 commit comments

Comments
 (0)