Hello,
In a log_by_lua directive, I’m creating per-request log records that I’m serializing and storing in a shared dictionary. A self-perpetuating ngx.timer periodically flushes entries from the dictionary and sends them to RabbitMQ. It’s a lot like what was discussed in this thread, but it looks like that conversation predated ngx.timer:
https://groups.google.com/d/msg/openresty-en/U7kwHEJsXd4/m6xcrvyFreUJ
I have a couple of questions:
- Is this still the best/most generally accepted way of logging directly to an external service from OpenResty?
- Are there any guidelines I should follow around the frequency of the ngx.timer calls? I’m currently running it every 5 seconds, but I just want to be sure I’m staying far away from some of the problems described in the documentation around the accumulation of timers.
Thank you,
Peter