mirror of
https://github.com/lancachenet/monolithic
synced 2024-11-21 19:43:05 +00:00
Merge pull request #167 from sfinke0/master
Implement additional log format: json access logs
This commit is contained in:
commit
aba04fc0ab
5 changed files with 7 additions and 4 deletions
|
@ -18,7 +18,8 @@ ENV GENERICCACHE_VERSION=2 \
|
||||||
LOGFILE_RETENTION=3560 \
|
LOGFILE_RETENTION=3560 \
|
||||||
CACHE_DOMAINS_REPO="https://github.com/uklans/cache-domains.git" \
|
CACHE_DOMAINS_REPO="https://github.com/uklans/cache-domains.git" \
|
||||||
CACHE_DOMAINS_BRANCH=master \
|
CACHE_DOMAINS_BRANCH=master \
|
||||||
NGINX_WORKER_PROCESSES=auto
|
NGINX_WORKER_PROCESSES=auto \
|
||||||
|
NGINX_LOG_FORMAT=cachelog
|
||||||
|
|
||||||
COPY overlay/ /
|
COPY overlay/ /
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
log_format cachelog '[$cacheidentifier] $remote_addr / $http_x_forwarded_for - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$upstream_cache_status" "$host" "$http_range"';
|
log_format cachelog '[$cacheidentifier] $remote_addr / $http_x_forwarded_for - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$upstream_cache_status" "$host" "$http_range"';
|
||||||
|
log_format cachelog-json escape=json '{"timestamp":"$msec","time_local":"$time_local","cache_identifier":"$cacheidentifier","remote_addr":"$remote_addr","forwarded_for":"$http_x_forwarded_for","remote_user":"$remote_user","status":"$status","bytes_sent":$body_bytes_sent,"referer":"$http_referer","user_agent":"$http_user_agent","upstream_cache_status":"$upstream_cache_status","host":"$host","http_range":"$http_range","method":"$request_method","path":"$request_uri","proto":"$server_protocol","scheme":"$scheme"}';
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
server {
|
server {
|
||||||
listen 80 reuseport;
|
listen 80 reuseport;
|
||||||
|
|
||||||
access_log /data/logs/access.log cachelog;
|
access_log /data/logs/access.log LOG_FORMAT;
|
||||||
error_log /data/logs/error.log;
|
error_log /data/logs/error.log;
|
||||||
|
|
||||||
include /etc/nginx/sites-available/cache.conf.d/*.conf;
|
include /etc/nginx/sites-available/cache.conf.d/*.conf;
|
||||||
|
|
|
@ -10,7 +10,7 @@ server {
|
||||||
|
|
||||||
# No access_log tracking as all requests to this instance are already logged through monolithic
|
# No access_log tracking as all requests to this instance are already logged through monolithic
|
||||||
|
|
||||||
# access_log /data/logs/upstream-access.log cachelog;
|
# access_log /data/logs/upstream-access.log LOG_FORMAT;
|
||||||
error_log /data/logs/upstream-error.log;
|
error_log /data/logs/upstream-error.log;
|
||||||
|
|
||||||
include /etc/nginx/sites-available/upstream.conf.d/*.conf;
|
include /etc/nginx/sites-available/upstream.conf.d/*.conf;
|
||||||
|
|
|
@ -19,3 +19,5 @@ sed -i "s/slice 1m;/slice ${CACHE_SLICE_SIZE};/" /etc/nginx/sites-available/cach
|
||||||
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/sites-available/cache.conf.d/10_root.conf
|
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/sites-available/cache.conf.d/10_root.conf
|
||||||
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/sites-available/upstream.conf.d/10_resolver.conf
|
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/sites-available/upstream.conf.d/10_resolver.conf
|
||||||
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/stream-available/10_sni.conf
|
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/nginx/stream-available/10_sni.conf
|
||||||
|
sed -i "s/LOG_FORMAT/${NGINX_LOG_FORMAT}/" /etc/nginx/sites-available/10_cache.conf
|
||||||
|
sed -i "s/LOG_FORMAT/${NGINX_LOG_FORMAT}/" /etc/nginx/sites-available/20_upstream.conf
|
||||||
|
|
Loading…
Reference in a new issue