Hello!
On Wed, Feb 4, 2015 at 2:37 AM, Chris Tanner wrote:
> I've tried that but without much luck.
I tried OpenResty 1.7.7.2 RC2 yesterday with the following minimal example:
error_log syslog:server=127.0.0.1:12345 error;
http {
init_worker_by_lua '
ngx.log(ngx.ERR, "error from init worker")
ngx.timer.at(0, function ()
ngx.log(ngx.ERR, "error from timer")
end)
';
server { ... }
}
Then I used nc to emulate a syslog server like this:
nc -u -l 12345
Then I started the server and got the following output from nc:
<187>Feb 4 12:05:45 w530 nginx: 2015/02/04 12:05:45 [error]
4868#0: [lua] init_worker_by_lua:2: error from init worker, context:
init_worker_by_lua*<187>Feb 4 12:05:45 w530 nginx: 2015/02/04
12:05:45 [error] 4868#0: [lua] init_worker_by_lua:4: error from timer,
context: ngx.timer
We can see that it works as expected.
BTW, please ensure that you're using the latest OpenResty (or nginx +
ngx_lua). I've heard before that some people have been using this
configuration in production without problems.
Regards,
-agentzh