title: error-log-logger

Summary

Name

error-log-logger is a plugin which pushes the log data of APISIX's error.log to TCP servers.

This plugin will provide the ability to send the log data which selected by the level to Monitoring tools and other TCP servers.

This plugin provides the ability as a batch to push the log data to your external TCP servers. If not receive the log data, don't worry, it will automatically send the logs after the timer function expires in our Batch Processor.

For more info on Batch-Processor in Apache APISIX please refer. Batch-Processor

Attributes

NameTypeRequirementDefaultValidDescription
hoststringrequiredIP address or the Hostname of the TCP server.
portintegerrequired[0,...]Target upstream port.
timeoutintegeroptional3[1,...]Timeout for the upstream to connect and send, unit: second.
keepaliveintegeroptional30[1,...]Time for keeping the cosocket alive, unit: second.
levelstringoptionalWARNThe filter's log level, default warn, choose the level in [“STDERR”, “EMERG”, “ALERT”, “CRIT”, “ERR”, “ERROR”, “WARN”, “NOTICE”, “INFO”, “DEBUG”], the value ERR equals ERROR.
tlsbooleanoptionalfalseControl whether to perform SSL verification
tls_server_namestringoptionalThe server name for the new TLS extension SNI
batch_max_sizeintegeroptional1000[1,...]Max size of each batch
inactive_timeoutintegeroptional3[1,...]Maximum age in seconds when the buffer will be flushed if inactive
buffer_durationintegeroptional60[1,...]Maximum age in seconds of the oldest entry in a batch before the batch must be processed
max_retry_countintegeroptional0[0,...]Maximum number of retries before removing from the processing pipe line
retry_delayintegeroptional1[0,...]Number of seconds the process execution should be delayed if the execution fails

How To Enable And Disable

The error-log-logger is a global plugin of APISIX.

Enable plugin

Enable the plug-in error-log-logger in conf/config.yaml, then this plugin can work fine. It does not need to be bound in any route or service.

Here is an example of conf/config.yaml:

plugins:                          # plugin list
  ... ...
  - request-id
  - hmac-auth
  - api-breaker
  - error-log-logger              # enable plugin `error-log-logger

Disable plugin

Remove or comment out the plugin error-log-logger from conf/config.yaml.

plugins:                          # plugin list
  ... ...
  - request-id
  - hmac-auth
  - api-breaker
  #- error-log-logger              # enable plugin `error-log-logger

How to set the TCP server address

Step: update the attributes of the plugin

curl http://127.0.0.1:9080/apisix/admin/plugin_metadata/error-log-logger -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
  "host": "127.0.0.1",
  "port": 1999,
  "inactive_timeout": 1
}'