file-logger
tip
file-logger
plugin can get APISIX variables and , whileaccess.log
can only use NGINX variables.file-logger
plugin support hot-loaded so that we can change its configuration at any time with immediate effect.- plugin saves every data in JSON format.
Attributes
You can also set the format of the logs by configuring the Plugin metadata. The following configurations are available:
Name | Type | Required | Default | Description |
---|---|---|---|---|
log_format | object | False | {“host”: “$host”, “@timestamp”: “$time_iso8601”, “client_ip”: “$remote_addr”} | Log format declared as key value pairs in JSON format. Values only support strings. APISIX or variables can be used by prefixing the string with $ . |
With this configuration, your logs would be formatted as shown below:
Enabling the Plugin
Now, if you make a request, it will be logged in the path you specified:
Disable Plugin
To disable the Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.