<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div><br></div><div>Hi,<br></div><div><br></div><div>I'm using 'nginx/1.21.1' for load balancing TCP connection for DBs like Teradata, Netezza, Oracle and MySQL. I'm using stream directive for it as per the guidance '<a href="https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/">https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/</a>' . <br></div><div><br></div><div>Following is my stream configuration (/etc/nginx/nginx.conf)<br></div><div>stream {<br></div><div> log_format timed_combined '$remote_addr - [$time_local] $session_time $msec $status $protocol ua="$upstream_addr" "$upstream_connect_time" "$upstream_response_time"';<br></div><div> access_log /var/log/nginx/access.log timed_combined;<br></div><div> <br></div><div> upstream stream_backend_mysql {<br></div><div> hash $remote_addr;<br></div><div> server 192.168.122.251:3306;<br></div><div> server 192.168.122.252:3306;<br></div><div> }<br></div><div> server {<br></div><div> listen 3306;<br></div><div> proxy_pass stream_backend_mysql;<br></div><div> proxy_connect_timeout 1s;<br></div><div> }<br></div><div>}<br></div><div><br></div><div>I'm able to establish connection for mysql in this setup, but when I'm adding the log_format directive nginx is giving following error,<br></div><div><b>'nginx: [emerg] unknown "upstream_response_time" variable' </b><br></div><div><br></div><div>My motive is to get metrics for this nginx tcp loadbalancer (like requests per seconds, number of active connections).<br></div><div><br></div><div>Please guide me on this as I'm a newbie in this field.<br></div><div><br></div><div>I'm attaching my nginx.conf for your reference with this mail. <br></div><div><br></div><div>Looking forward for your response.<br></div><div><br></div><div>Thank you in anticipation!<br></div><div><br></div><div>Regards,<br></div><div>Akki</div></div><br></body></html>