nginx写入日志到sqlite(nginx writre log to sqlite)

请你能帮我,我可以让NGINX直接写访问日志到sqlite表,我将使access.log中的字段相同?

我知道我可以尝试使用LUA来做到这一点,但我不知道如何将触发器放到nginx上,以便在access.log文件中的每个记录上运行LUA脚本

please could you help me can I let NGINX to write access log directly to sqlite table which I will make the same field as in access.log?

I know I can try to do it with LUA, but I do not know how to put the trigger to nginx to run LUA script on every record in access.log file

最满意答案

您可以使用log_by_lua阶段来编写访问日志,因为它最后一次运行并允许您访问像upstream_response_time等变量。

You would use the log_by_lua phase to write access logs, as it runs last and allows you to access variables like upstream_response_time, etc.

更多推荐