4 ms·
On the topic of Nginx, does anyone know if it's possible/how one could fire off a http request (GET or POST) to an external service to log requests in real time
by _kyran 10y ago
On the topic of Nginx, does anyone know if it's possible/how one could fire off a http request (GET or POST) to an external service to log requests in real time (rather than say logging to a text file then processing that)?
- nhumrich 10y agoSyslog
- otterley 10y agoBut you really don't want to do that if you need accurate log collection and aggregation. Having a local log file is essential to coping with backpressure from the log consumers. Consider what might happen if the remote syslog server goes down or is overburdened.
- deleted 10y ago[deleted]
- rkrzr 10y agoYou can do it using the nginx-lua module, something like: `local response = ngx.location.capture("/some/api/endpoint" )` I would not recommend doing this, though. Nginx internals are rather complicated in my experience.
- _kyran 10y agoThanks! So better off to just log to a file and monitor the tail of that and send the data off with a seperate script?
- zzzcpan 10y agoIt's undocumented, but you can do that with post_action: location /foo/ { ... post_action @mirror_request; } location @mirror_request { proxy_pass ...; }
- _kyran 10y agoThank you so much! That looks perfect.