Slide 18
Slide 18 text
-- 127.0.0.1:24224 ͷ fluentd ʹଓ
local ok, err = sock:connect("127.0.0.1", 24224)
if not ok then
return ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
end
-- forward ܗࣜͷϝοηʔδΛΈཱͯͯ͛Δ
local bytes, err = sock:send(
msgpack.pack({"access", ngx.time(), args})
)
if err then
return ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
end
sock:setkeepalive(10000) -- keepalive 10 sec.
-- ϨεϙϯεΛฦ͢
ngx.header.content_type = "text/plain"
ngx.say("ok")