lua_socket_log_errors does not suppress errors connecting to unix-domain sockets
If using the lua_socket_log_errors off setting, this option seems to have no effect on connection errors to unix-domain sockets. Connection errors to unix domain sockets seem to be logged to the error log regardless of this setting. Compare that to connecting to a host and port, in which case the lua_socket_log_errors off setting successfully suppresses from the error from the nginx error log.
I'm currently testing this against OpenResty 1.15.8.2.
Here's an example:
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
lua_socket_log_errors off;
server {
listen 8080;
location / {
content_by_lua_block {
local sock = ngx.socket.tcp()
sock:connect("unix:/tmp")
}
}
}
}
Which generates this line in the error log:
2019/11/01 15:14:33 [error] 355#355: *1 connect() to unix:/tmp failed (111: Connection refused), client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
Compare that to when connecting to host/ports, like sock:connect("127.0.0.1", 9999) (or some other port that isn't running locally), which does not log any connection refused errors as long as lua_socket_log_errors off is set (but does log connection refused errors when lua_socket_log_errors on).
Is it possible for lua_socket_log_errors to also toggle error logging behavior for unix-domain sockets? Thanks!
This error message is thrown by the function ngx_event_connect_peer(ngx_peer_connection_t *pc), which is outside the control of lua-nginx-module.