nginx-amplify-agent
nginx-amplify-agent copied to clipboard
Nginx Key Performance Metrics Not Available ?
Hi with add new set in custom dashboards I am seeing

is custom log format's 'ut="$upstream_response_time" not enough to satisfy key metric nginx.upstream_response_time ?
I have Nginx 1.15.5 with log formats default nginx main_ext and custom one extended as main_extssl
log_format main_ext '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
log_format main_extssl '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status'
' "$gzip_ratio" "$brotli_ratio" '
'$http2 $ssl_protocol $ssl_cipher $ssl_session_reused $ssl_early_data '
'$http_content_length $http_content_encoding $request_length '
'$tcpinfo_rtt $tcpinfo_snd_cwnd '
'$http_cf_ipcountry $http_cf_ray';
nginx vhost has logs as
access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=5m;
access_log /home/nginx/domains/domain.com/log/cfssl-access.log main_extssl buffer=256k flush=5m;
error_log /home/nginx/domains/domain.com/log/error.log;
ls -lah
total 56K
drwxr-s--- 2 nginx nginx 4.0K Oct 27 01:06 .
drwxr-s--- 6 nginx nginx 4.0K Oct 27 00:59 ..
-rw-r--r-- 1 root nginx 13K Oct 27 01:35 access.log
-rw-r--r-- 1 root nginx 30K Oct 27 01:35 cfssl-access.log
-rw-r--r-- 1 root nginx 0 Oct 27 01:00 error.log
Then in /etc/amplify-agent/agent.conf exclude the default Centmin Mod Nginx log format /home/nginx/domains/domain.com/log/access.log where vhosts are setup as
/home/nginx/domains/domain.com/log
/home/nginx/domains/domain2.com/log
/home/nginx/domains/domain3.com/log
[nginx]
exclude_logs=/home/nginx/domains/*/log/access.log,/home/nginx/domains/*/log/access-*.log
The resulting logs will show
tail -1 access.log
xxx.xxx.xxx.xxx - - [27/Oct/2018:01:13:51 +0000] "GET / HTTP/2.0" 200 2102 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.52"
tail -1 cfssl-access.log
xxx.xxx.xxx.xxx - - [27/Oct/2018:01:13:51 +0000] "GET / HTTP/2.0" 200 2102 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.52" "-" "domain.com" sn="domain.com" rt=0.000 ua="-" us="-" ut="-" ul="-" cs=- "3.15" "-" h2 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 . - - - 302 34634 10 - -