I have a similar need to https://github.com/openresty/lua-nginx-module/issues/220
My use case
- I'm forwarding files to a remote server, through using
proxy_pass. - I need to pass
$body_bytes_sentto a remote url, after proxy pass. - I thought about doing a
content_by_luablock, with anngx.captureforwarded to theproxy_passblock, with anngx.say()returning what came fromngx.capture. Followed by a request with $body_bytes_sent to the remote url. But I need to support streaming, which this wouldn't do. And files can get quite big which is bad forngx.capture(). - I thought about doing a
log_by_luablock, but cosockets apis are disabled. https://github.com/openresty/lua-nginx-module#log_by_lua
proxy_pass, has anaccess_by_luablock that queries a microservice. In our setup, the microservice is fed data fromlog_by_lua, which lets it determine if a particular url should be accessible or not. ---- The remote server insideproxy_passis out of our control. So we couldn't have done it there. --- Logstash was given some thought. But I thought it would have complicated things, since I would have needed to send a copy of the logs to the microservice.