Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apisix/plugins/loggly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local batch_processor_manager = bp_manager_mod.new(plugin_name)


local severity = {
EMEGR = 0, -- system is unusable
EMERG = 0, -- system is unusable
ALERT = 1, -- action must be taken immediately
CRIT = 2, -- critical conditions
ERR = 3, -- error conditions
Expand Down
2 changes: 1 addition & 1 deletion apisix/utils/rfc5424.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ local Facility = {
}

local Severity = {
EMEGR = LOG_EMERG,
EMERG = LOG_EMERG,
ALERT = LOG_ALERT,
CRIT = LOG_CRIT,
ERR = LOG_ERR,
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/plugins/loggly.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ When the maximum batch size is exceeded, the data in the queue is pushed to Logg
| Name | Type | Required | Default | Description |
|------------------------|---------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| customer_token | string | True | | Unique identifier used when sending logs to Loggly to ensure that they are sent to the right organisation account. |
| severity | string (enum) | False | INFO | Syslog log event severity level. Choose between: `DEBUG`, `INFO`, `NOTICE`, `WARNING`, `ERR`, `CRIT`, `ALERT`, and `EMEGR`. |
| severity | string (enum) | False | INFO | Syslog log event severity level. Choose between: `DEBUG`, `INFO`, `NOTICE`, `WARNING`, `ERR`, `CRIT`, `ALERT`, and `EMERG`. |
| severity_map | object | False | nil | A way to map upstream HTTP response codes to Syslog severity. Key-value pairs where keys are the HTTP response codes and the values are the Syslog severity levels. For example `{"410": "CRIT"}`. |
| tags | array | False | | Metadata to be included with any event log to aid in segmentation and filtering. |
| log_format | object | False | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} | Log format declared as key-value pairs in JSON. Values support strings and nested objects (up to five levels deep; deeper fields are truncated). Within strings, [APISIX](../apisix-variable.md) or [NGINX](http://nginx.org/en/docs/varindex.html) variables can be referenced by prefixing with `$`. |
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/latest/plugins/loggly.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ description: API 网关 Apache APISIX loggly 插件可用于将日志转发到 S
| 名称 | 类型 | 必选项 | 默认值 | 描述 |
|------------------------|---------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| customer_token | string | 是 | | 将日志发送到 Loggly 时使用的唯一标识符,以确保将日志发送到正确的组织帐户。 |
| severity | string (enum) | 否 | INFO | Syslog 日志事件的严重性级别。包括:`DEBUG`、`INFO`、`NOTICE`、`WARNING`、`ERR`、`CRIT`、`ALERT` 和 `EMEGR`。 |
| severity | string (enum) | 否 | INFO | Syslog 日志事件的严重性级别。包括:`DEBUG`、`INFO`、`NOTICE`、`WARNING`、`ERR`、`CRIT`、`ALERT` 和 `EMERG`。 |
| severity_map | object | 否 | nil | 一种将上游 HTTP 响应代码映射到 Syslog 中的方法。 `key-value`,其中 `key` 是 HTTP 响应代码,`value`是 Syslog 严重级别。例如`{"410": "CRIT"}`。 |
| tags | array | 否 | | 元数据将包含在任何事件日志中,以帮助进行分段和过滤。 |
| log_format | object | 否 | | | 日志格式以 JSON 的键值对声明。值支持字符串和嵌套对象(最多五层,超出部分将被截断)。字符串中可通过在前面加上 `$` 来引用 [APISIX 变量](../apisix-variable.md) 或 [NGINX 内置变量](http://nginx.org/en/docs/varindex.html)。 |
Expand Down
12 changes: 12 additions & 0 deletions t/plugin/loggly.t
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ __DATA__
{
customer_token = "test",
severity = "crit",
},
-- syslog emergency severity should pass
{
customer_token = "test",
severity = "EMERG",
},
-- misspelled legacy severity should be rejected
{
customer_token = "test",
severity = "EMEGR",
}
}

Expand All @@ -138,6 +148,8 @@ passed
property "customer_token" is required
property "severity" validation failed: matches none of the enum values
passed
passed
property "severity" validation failed: matches none of the enum values



Expand Down
Loading