http-logger

This will allow the ability to send log data requests as JSON objects to monitoring tools and other HTTP servers.

Attributes

note

This Plugin supports using batch processors to aggregate and process entries (logs/data) in a batch. This avoids the need for frequently submitting the data. The batch processor submits data every 5 seconds or when the data in the queue reaches 1000. See for more information or setting your custom configuration.

NameTypeRequiredDefaultDescription
log_formatobjectFalse{“host”: “$host”, “@timestamp”: “$time_iso8601”, “client_ip”: “$remote_addr”}Log format declared as key value pairs in JSON format. Values only support strings. or Nginx variables can be used by prefixing the string with $.
http-logger - 图2IMPORTANT

Configuring the Plugin metadata is global in scope. This means that it will take effect on all Routes and Services which use the Plugin.

The example below shows how you can configure through the Admin API:

Enabling the Plugin

The example below shows how you can enable the Plugin on a specific Route:

As an example the server is used for mocking an HTTP server to see the logs produced by APISIX.

Disable Plugin

To disable this 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.