You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use UDP to send the log data sent to logstash, about 10 requests per second, each sending a thousand probably only received 400-600, strange, Udp in the LAN, the concurrency is not high, how to lose the log It?
local logger = require "resty.logger.socket"
local json = require "cjson"
if not logger then
ngx.log(ngx.ERR, "can't required logger module")
end
if not logger.initted() then
local ok, err = logger.init{
host = '10.105.7.43',
port = 5000,
sock_type = 'udp',
flush_limit = 1,
drop_limit = 5678,
}
if not ok then
ngx.log(ngx.ERR, "failed to initialize the logger: ",
err)
end
end
local log = {}
local client = ngx.var.http_x_forwarded_for
local url = ngx.var.uri
local x_auth_token = ngx.req.get_headers()['X-AUTH-TOKEN']
local method = ngx.var.request_method
log['client'] = client
log['url'] = url
log['method'] = method
log['X-AUTH-TOKEN'] = x_auth_token
local bytes, err = logger.log(json.encode(log))
if bytes then
ngx.log(ngx.INFO, "send done")
end
if err then
ngx.log(ngx.ERR, "failed to log message: ", err)
end
The text was updated successfully, but these errors were encountered:
vegaoqiang
changed the title
发送日志到logstash,出现丢失日志的情况?
Sent log to logstash, log loss occurred?
Dec 20, 2017
vegaoqiang
changed the title
Sent log to logstash, log loss occurred?
Sent log data to logstash, log loss occurred?
Dec 20, 2017
Uh oh!
There was an error while loading. Please reload this page.
Use UDP to send the log data sent to logstash, about 10 requests per second, each sending a thousand probably only received 400-600, strange, Udp in the LAN, the concurrency is not high, how to lose the log It?
The text was updated successfully, but these errors were encountered: