cloudflare / lua-resty-logger-socket

Raw-socket-based Logger Library for Nginx (based on ngx_lua)
488 stars 130 forks source link

Unable to use this plugin for log into local server log files #57

Open sandbh opened 3 years ago

sandbh commented 3 years ago

Trying to use this plugin for log into local server log files like /var/log/messages' or in some custom log file apart from nginx access or error log ie /var/log/testing.log etc. But unable to do this. getting following errors while trying failed to flush log message: try to send log messages to the log server failed after 3 retries: try to connect to the log server failed after 3 retries: connection refused failed to flush log message: try to send log messages to the log server failed after 3 retries: try to connect to the log server failed after 3 retries: permission denied Am I configuring something wrong......

local ok, err = logger.init{ host = 'localhost', path='/var/log/messages', } if not ok then ngx.log(ngx.ERR, "failed to initialize the logger: ", err) return end end -- construct the custom access log message in -- the Lua variable "msg"

            local bytes, err = logger.log(msg)
            if err then
                ngx.log(ngx.ERR, ".failed to log message: ", err)
                return
            end
            local bytes, err = logger.flush()
            if err then
                 **ngx.log(ngx.ERR, "failed to flush  log message: ", err)**
                return
            end