The Atatus NGINX Lua Plugin logs API calls to Atatus for API analytics and monitoring.
This plugin supports any NGINX Open Source that has OpenResty installed, including API gateways built on top of OpenResty.

How to Install

  1. Ensure you have lua-nginx-module installed.
    • If you’re running an OpenResty image, it’s already installed.
    • If you’re using NGINX Plus, follow the official NGINX Plus Lua module setup
  2. Install the Atatus LuaRock:

Configuration (Generic OpenResty)

Edit your nginx.conf to load the Atatus plugin. If needed, replace /usr/local/openresty/luajit/share/lua/5.1/resty with the correct Lua plugin installation path. You can find it using:

Example Configuration

Important: NGINX supports log_by_lua* only once in the same section. If your configuration already uses the same NGINX directives as Atatus, adjust accordingly. see OpenResty docs

Configuration Options

Static Options (set at startup in init_by_lua_block)

Dynamic Variables (set per request)

Set these variables in ngx.var (e.g., in header_filter_by_lua_block or body_filter_by_lua_block):

Example:

Troubleshooting

  • Response body not logged
If response bodies are not being captured in Atatus, your setup may require an internal proxy_pass. Without proxy_pass:
With proxy_pass: