Merge pull request #7690 from EMQ-YangM/log_config_i18n_support

feat(emqx_conf_schema): log config add i18n support
This commit is contained in:
Yang Miao 2022-04-20 18:16:21 +08:00 committed by GitHub
commit 249ef5ad34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 348 additions and 184 deletions

View File

@ -806,121 +806,121 @@ Ensure that the number of completed transactions is less than the <code>max_hist
log_file_handlers { log_file_handlers {
desc { desc {
en: """Key-value list of file-based log handlers.""" en: """Key-value list of file-based log handlers."""
zh: """""" zh: """基于文件的日志处理进程的键值列表。"""
} }
label: { label: {
en: "" en: "Log Handlers Key Val List"
zh: "" zh: "日志处理进程键值列表"
} }
} }
log_error_logger { log_error_logger {
desc { desc {
en: """Deprecated.""" en: """Deprecated."""
zh: """""" zh: """该配置已弃用。"""
} }
label: { label: {
en: "" en: "Deprecate"
zh: "" zh: "配置已弃用"
} }
} }
console_handler_enable { console_handler_enable {
desc { desc {
en: """Enable this log handler.""" en: """Enable this log handler."""
zh: """""" zh: """启用此日志处理进程。"""
} }
label: { label: {
en: "" en: "Enable Log Handler"
zh: "" zh: "启用日志处理进程"
} }
} }
console_handler_level { console_handler_level {
desc { desc {
en: """Global log level. This includes the primary log level and all log handlers.""" en: """Global log level. This includes the primary log level and all log handlers."""
zh: """""" zh: """全局日志级别。 这包括主日志级别和所有日志处理进程。"""
} }
label: { label: {
en: "" en: "Global Log Level"
zh: "" zh: "全局日志级别"
} }
} }
console_handler_time_offset { console_handler_time_offset {
desc { desc {
en: """The time offset to be used when formatting the timestamp.""" en: """The time offset to be used when formatting the timestamp."""
zh: """""" zh: """格式化时间戳时,使用的时间偏移量。"""
} }
label: { label: {
en: "" en: "Time Offset"
zh: "" zh: "时间偏移量"
} }
} }
console_handler_chars_limit { console_handler_chars_limit {
desc { desc {
en: """Set the maximum length of a single log message. If this length is exceeded, the log message will be truncated.""" en: """Set the maximum length of a single log message. If this length is exceeded, the log message will be truncated."""
zh: """""" zh: """设置单个日志消息的最大长度。 如果超过此长度,则日志消息将被截断。"""
} }
label: { label: {
en: "" en: "Single Log Max Length"
zh: "" zh: "单个日志最大长度"
} }
} }
console_handler_formatter { console_handler_formatter {
desc { desc {
en: """Choose log format. <code>text</code> for free text, and <code>json</code> for structured logging.""" en: """Choose log format. <code>text</code> for free text, and <code>json</code> for structured logging."""
zh: """""" zh: """选择日志格式。 <code>text</code> 用于自由文本,<code>json</code> 用于结构化日志记录。"""
} }
label: { label: {
en: "" en: "Log Format"
zh: "" zh: "日志格式"
} }
} }
console_handler_single_line { console_handler_single_line {
desc { desc {
en: """Print logs in a single line if set to true. Otherwise, log messages may span multiple lines.""" en: """Print logs in a single line if set to true. Otherwise, log messages may span multiple lines."""
zh: """""" zh: """如果设置为 true则在一行中打印日志。 否则,日志消息可能跨越多行。"""
} }
label: { label: {
en: "" en: "Single Line Mode"
zh: "" zh: "单行模式"
} }
} }
console_handler_sync_mode_qlen { console_handler_sync_mode_qlen {
desc { desc {
en: """As long as the number of buffered log events is lower than this value, all log events are handled asynchronously.""" en: """As long as the number of buffered log events is lower than this value, all log events are handled asynchronously."""
zh: """""" zh: """只要缓冲的日志事件的数量低于这个值,所有的日志事件都会被异步处理。"""
} }
label: { label: {
en: "" en: "Sync Mode Max Log Events"
zh: "" zh: "异步模式最大事件数"
} }
} }
console_handler_drop_mode_qlen { console_handler_drop_mode_qlen {
desc { desc {
en: """When the number of buffered log events is larger than this value, the new log events are dropped.<br/>When drop mode is activated or deactivated, a message is printed in the logs.""" en: """When the number of buffered log events is larger than this value, the new log events are dropped.<br/>When drop mode is activated or deactivated, a message is printed in the logs."""
zh: """""" zh: """当缓冲的日志事件数大于此值时,新的日志事件将被丢弃。<br/>启用或停用丢弃模式时,会在日志中打印一条消息。"""
} }
label: { label: {
en: "" en: "Drop Mode Max Log Events"
zh: "" zh: "缓存最大日志事件数"
} }
} }
console_handler_flush_qlen { console_handler_flush_qlen {
desc { desc {
en: """If the number of buffered log events grows larger than this threshold, a flush (delete) operation takes place. To flush events, the handler discards the buffered log messages without logging.""" en: """If the number of buffered log events grows larger than this threshold, a flush (delete) operation takes place. To flush events, the handler discards the buffered log messages without logging."""
zh: """""" zh: """如果缓冲日志事件的数量增长大于此阈值,则会发生刷新(删除)操作。 为了完成刷新事件,处理进程丢弃缓冲的日志消息。"""
} }
label: { label: {
en: "" en: "Flush Threshold"
zh: "" zh: "刷新阈值"
} }
} }
@ -929,143 +929,145 @@ Ensure that the number of completed transactions is less than the <code>max_hist
en: """Type of supervisor reports that are logged. en: """Type of supervisor reports that are logged.
- `error`: only log errors in the Erlang processes. - `error`: only log errors in the Erlang processes.
- `progress`: log process startup.""" - `progress`: log process startup."""
zh: """""" zh: """ supervisor 报告的类型。
- `error`:仅记录 Erlang 进程中的错误。
- `progress`:记录进程启动。"""
} }
label: { label: {
en: "" en: "Report Type"
zh: "" zh: "报告类型"
} }
} }
console_handler_max_depth { console_handler_max_depth {
desc { desc {
en: """Maximum depth for Erlang term log formatting and Erlang process message queue inspection.""" en: """Maximum depth for Erlang term log formatting and Erlang process message queue inspection."""
zh: """""" zh: """Erlang 内部格式日志格式化和 Erlang 进程消息队列检查的最大深度。"""
} }
label: { label: {
en: "" en: "Max Depth"
zh: "" zh: "最大深度"
} }
} }
log_file_handler_file { log_file_handler_file {
desc { desc {
en: """Name the log file.""" en: """Name the log file."""
zh: """""" zh: """日志文件名字。"""
} }
label: { label: {
en: "" en: "Log File Name"
zh: "" zh: "日志文件名字"
} }
} }
log_file_handler_max_size { log_file_handler_max_size {
desc { desc {
en: """This parameter controls log file rotation. The value `infinity` means the log file will grow indefinitely, otherwise the log file will be rotated once it reaches `max_size` in bytes.""" en: """This parameter controls log file rotation. The value `infinity` means the log file will grow indefinitely, otherwise the log file will be rotated once it reaches `max_size` in bytes."""
zh: """""" zh: """此参数控制日志文件轮换。 `infinity` 意味着日志文件将无限增长,否则日志文件将在达到 `max_size`(以字节为单位)时进行轮换。"""
} }
label: { label: {
en: "" en: "Rotation Size"
zh: "" zh: "日志文件轮换大小"
} }
} }
log_file_handler_enable { log_file_handler_enable {
desc { desc {
en: """Enable this log handler.""" en: """Enable this log handler."""
zh: """""" zh: """启用此日志处理进程。"""
} }
label: { label: {
en: "" en: "Enable Log Handler"
zh: "" zh: "启用此日志处理进程"
} }
} }
log_file_handler_level { log_file_handler_level {
desc { desc {
en: """Global log level. This includes the primary log level and all log handlers.""" en: """Global log level. This includes the primary log level and all log handlers."""
zh: """""" zh: """全局日志级别。 这包括主日志级别和所有日志处理进程。"""
} }
label: { label: {
en: "" en: "Global Level"
zh: "" zh: "全局日志级别"
} }
} }
log_file_handler_time_offset { log_file_handler_time_offset {
desc { desc {
en: """The time offset to be used when formatting the timestamp.""" en: """The time offset to be used when formatting the timestamp."""
zh: """""" zh: """格式化时间戳时要使用的时间偏移量。"""
} }
label: { label: {
en: "" en: "Time Offset"
zh: "" zh: "时间偏移"
} }
} }
log_file_handler_chars_limit { log_file_handler_chars_limit {
desc { desc {
en: """Set the maximum length of a single log message. If this length is exceeded, the log message will be truncated.""" en: """Set the maximum length of a single log message. If this length is exceeded, the log message will be truncated."""
zh: """""" zh: """设置单个日志消息的最大长度。 如果超过此长度,则日志消息将被截断。"""
} }
label: { label: {
en: "" en: "Single Log Max Length"
zh: "" zh: "单个日志消息最大长度"
} }
} }
log_file_handler_formatter { log_file_handler_formatter {
desc { desc {
en: """Choose log format. <code>text</code> for free text, and <code>json</code> for structured logging.""" en: """Choose log format. <code>text</code> for free text, and <code>json</code> for structured logging."""
zh: """""" zh: """选择日志格式。 <code>text</code> 用于自由文本,<code>json</code> 用于结构化日志记录。"""
} }
label: { label: {
en: "" en: "Log Format"
zh: "" zh: "日志格式"
} }
} }
log_file_handler_single_line { log_file_handler_single_line {
desc { desc {
en: """Print logs in a single line if set to true. Otherwise, log messages may span multiple lines.""" en: """Print logs in a single line if set to true. Otherwise, log messages may span multiple lines."""
zh: """""" zh: """如果设置为 true则在一行中打印日志。 否则,日志消息可能跨越多行。"""
} }
label: { label: {
en: "" en: "Single Line Mode"
zh: "" zh: "单行模式"
} }
} }
log_file_handler_sync_mode_qlen { log_file_handler_sync_mode_qlen {
desc { desc {
en: """As long as the number of buffered log events is lower than this value, all log events are handled asynchronously.""" en: """As long as the number of buffered log events is lower than this value, all log events are handled asynchronously."""
zh: """""" zh: """只要缓冲的日志事件的数量低于这个值,所有的日志事件都会被异步处理。"""
} }
label: { label: {
en: "" en: "Sync Mode Max Log Events"
zh: "" zh: "异步模式最大事件数"
} }
} }
log_file_handler_drop_mode_qlen { log_file_handler_drop_mode_qlen {
desc { desc {
en: """When the number of buffered log events is larger than this value, the new log events are dropped.<br/>When drop mode is activated or deactivated, a message is printed in the logs.""" en: """When the number of buffered log events is larger than this value, the new log events are dropped.<br/>When drop mode is activated or deactivated, a message is printed in the logs."""
zh: """""" zh: """当缓冲的日志事件数大于此值时,新的日志事件将被丢弃。<br/>启用或停用丢弃模式时,会在日志中打印一条消息。"""
} }
label: { label: {
en: "" en: "Drop Mode Max Log Events"
zh: "" zh: "缓存最大日志事件数"
} }
} }
log_file_handler_flush_qlen { log_file_handler_flush_qlen {
desc { desc {
en: """If the number of buffered log events grows larger than this threshold, a flush (delete) operation takes place. To flush events, the handler discards the buffered log messages without logging.""" en: """If the number of buffered log events grows larger than this threshold, a flush (delete) operation takes place. To flush events, the handler discards the buffered log messages without logging."""
zh: """""" zh: """如果缓冲日志事件的数量增长大于此阈值,则会发生刷新(删除)操作。 为了完成刷新事件,处理进程丢弃缓冲的日志消息。"""
} }
label: { label: {
en: "" en: "Flush Threshold"
zh: "" zh: "刷新阈值"
} }
} }
@ -1074,121 +1076,123 @@ Ensure that the number of completed transactions is less than the <code>max_hist
en: """Type of supervisor reports that are logged. en: """Type of supervisor reports that are logged.
- `error`: only log errors in the Erlang processes. - `error`: only log errors in the Erlang processes.
- `progress`: log process startup.""" - `progress`: log process startup."""
zh: """""" zh: """ supervisor 报告的类型。
- `error`:仅记录 Erlang 进程中的错误。
- `progress`:记录进程启动。"""
} }
label: { label: {
en: "" en: "Report Type"
zh: "" zh: "报告类型"
} }
} }
log_file_handler_max_depth { log_file_handler_max_depth {
desc { desc {
en: """Maximum depth for Erlang term log formatting and Erlang process message queue inspection.""" en: """Maximum depth for Erlang term log formatting and Erlang process message queue inspection."""
zh: """""" zh: """Erlang 内部格式日志格式化和 Erlang 进程消息队列检查的最大深度。"""
} }
label: { label: {
en: "" en: "Max Depth"
zh: "" zh: "最大深度"
} }
} }
log_rotation_enable { log_rotation_enable {
desc { desc {
en: """Enable log rotation feature.""" en: """Enable log rotation feature."""
zh: """""" zh: """启用日志轮换功能。"""
} }
label: { label: {
en: "" en: "Rotation Enable"
zh: "" zh: "日志轮换"
} }
} }
log_rotation_count { log_rotation_count {
desc { desc {
en: """Maximum number of log files.""" en: """Maximum number of log files."""
zh: """""" zh: """最大日志文件数。"""
} }
label: { label: {
en: "" en: "Max Log Files Number"
zh: "" zh: "最大日志文件数"
} }
} }
log_overload_kill_enable { log_overload_kill_enable {
desc { desc {
en: """Enable log handler overload kill feature.""" en: """Enable log handler overload kill feature."""
zh: """""" zh: """启用日志处理进程过载终止功能。"""
} }
label: { label: {
en: "" en: "Log Handler Overload Kill"
zh: "" zh: "日志处理进程过载终止"
} }
} }
log_overload_kill_mem_size { log_overload_kill_mem_size {
desc { desc {
en: """Maximum memory size that the handler process is allowed to use.""" en: """Maximum memory size that the handler process is allowed to use."""
zh: """""" zh: """处理进程进程允许使用的最大内存。"""
} }
label: { label: {
en: "" en: "Handler Allowed Max Memory Size"
zh: "" zh: "理进程进程允许使用的最大内存"
} }
} }
log_overload_kill_qlen { log_overload_kill_qlen {
desc { desc {
en: """Maximum allowed queue length.""" en: """Maximum allowed queue length."""
zh: """""" zh: """允许的最大队列长度。"""
} }
label: { label: {
en: "" en: "Max Queue Length"
zh: "" zh: "最大队列长度"
} }
} }
log_overload_kill_restart_after { log_overload_kill_restart_after {
desc { desc {
en: """If the handler is terminated, it restarts automatically after a delay specified in milliseconds. The value `infinity` prevents restarts.""" en: """If the handler is terminated, it restarts automatically after a delay specified in milliseconds. The value `infinity` prevents restarts."""
zh: """""" zh: """如果处理进程终止,它会在以毫秒为单位指定的延迟后自动重新启动。 `infinity` 防止重新启动。"""
} }
label: { label: {
en: "" en: "Handler Restart Delay"
zh: "" zh: "处理进程重启延迟"
} }
} }
log_burst_limit_enable { log_burst_limit_enable {
desc { desc {
en: """Enable log burst control feature.""" en: """Enable log burst control feature."""
zh: """""" zh: """启用日志突发控制功能。"""
} }
label: { label: {
en: "" en: "Enable Burst"
zh: "" zh: "启用日志突发控制"
} }
} }
log_burst_limit_max_count { log_burst_limit_max_count {
desc { desc {
en: """Maximum number of log events to handle within a `window_time` interval. After the limit is reached, successive events are dropped until the end of the `window_time`.""" en: """Maximum number of log events to handle within a `window_time` interval. After the limit is reached, successive events are dropped until the end of the `window_time`."""
zh: """""" zh: """在 `window_time` 间隔内处理的最大日志事件数。 达到限制后,将丢弃连续事件,直到 `window_time` 结束。"""
} }
label: { label: {
en: "" en: "Events Number"
zh: "" zh: "日志事件数"
} }
} }
log_burst_limit_window_time { log_burst_limit_window_time {
desc { desc {
en: """See `max_count`.""" en: """See `max_count`."""
zh: """""" zh: """参考 `max_count`。"""
} }
label: { label: {
en: "" en: "Window Time"
zh: "" zh: "Window Time"
} }
} }
@ -1213,4 +1217,201 @@ natively in the EMQX node;<br>
} }
} }
desc_cluster {
desc {
en: """EMQX nodes can form a cluster to scale up the total capacity.<br>Here holds the configs to instruct how individual nodes can discover each other."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_cluster_static {
desc {
en: """Service discovery via static nodes. The new node joins the cluster by connecting to one of the bootstrap nodes."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_cluster_mcast {
desc {
en: """Service discovery via UDP multicast."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_cluster_dns {
desc {
en: """Service discovery via DNS SRV records."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_cluster_etcd {
desc {
en: """Service discovery using 'etcd' service."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_cluster_k8s {
desc {
en: """Service discovery via Kubernetes API server."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_node {
desc {
en: """Node name, cookie, config & data directories and the Erlang virtual machine (BEAM) boot parameters."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_db {
desc {
en: """Settings for the embedded database."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_cluster_call {
desc {
en: """Options for the 'cluster call' feature that allows to execute a callback on all nodes in the cluster."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_rpc {
desc {
en: """EMQX uses a library called <code>gen_rpc</code> for inter-broker communication.<br/>Most of the time the default config should work, but in case you need to do performance fine-tuning or experiment a bit, this is where to look."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
desc_log {
desc {
en: """EMQX logging supports multiple sinks for the log events. Each sink is represented by a _log handler_, which can be configured independently."""
zh: """EMQX 日志记录支持日志事件的多个接收器。 每个接收器由一个_log handler_表示可以独立配置。"""
}
label: {
en: "Log"
zh: "日志"
}
}
desc_console_handler {
desc {
en: """Log handler that prints log events to the EMQX console."""
zh: """日志处理进程将日志事件打印到 EMQX 控制台。"""
}
label: {
en: "Console Log Handler"
zh: "控制台日志处理进程"
}
}
desc_log_file_handler {
desc {
en: """Log handler that prints log events to files."""
zh: """日志处理进程将日志事件打印到文件。"""
}
label: {
en: "Files Log Handler"
zh: "文件日志处理进程"
}
}
desc_log_rotation {
desc {
en: """By default, the logs are stored in `./log` directory (for installation from zip file) or in `/var/log/emqx` (for binary installation).<br/>This section of the configuration controls the number of files kept for each log handler."""
zh: """默认情况下,日志存储在 `./log` 目录(用于从 zip 文件安装)或 `/var/log/emqx`(用于二进制安装)。<br/>这部分配置,控制每个日志处理进程保留的文件数量。"""
}
label: {
en: "Log Rotation"
zh: "日志轮换"
}
}
desc_log_overload_kill {
desc {
en: """Log overload kill features an overload protection that activates when the log handlers use too much memory or have too many buffered log messages.<br/>When the overload is detected, the log handler is terminated and restarted after a cooldown period."""
zh: """日志过载终止,具有过载保护功能。当日志处理进程使用过多内存,或者缓存的日志消息过多时该功能被激活。<br/>检测到过载时,日志处理进程将终止,并在冷却期后重新启动。"""
}
label: {
en: "Log Overload Kill"
zh: "日志过载保护"
}
}
desc_log_burst_limit {
desc {
en: """Large bursts of log events produced in a short time can potentially cause problems, such as:
- Log files grow very large
- Log files are rotated too quickly, and useful information gets overwritten
- Overall performance impact on the system
Log burst limit feature can temporarily disable logging to avoid these issues."""
zh: """短时间内产生的大量日志事件可能会导致问题,例如:
- 日志文件变得非常大
- 日志文件轮换过快,有用信息被覆盖
- 对系统的整体性能影响
日志突发限制功能可以暂时禁用日志记录以避免这些问题。"""
}
label: {
en: "Log Burst Limit"
zh: "日志突发限制"
}
}
desc_authorization {
desc {
en: """Settings that control client authorization."""
zh: """"""
}
label: {
en: ""
zh: ""
}
}
} }

View File

@ -661,12 +661,12 @@ fields("log") ->
[ {"console_handler", ref("console_handler")} [ {"console_handler", ref("console_handler")}
, {"file_handlers", , {"file_handlers",
sc(map(name, ref("log_file_handler")), sc(map(name, ref("log_file_handler")),
#{desc => "Key-value list of file-based log handlers."})} #{desc => ?DESC("log_file_handlers")})}
, {"error_logger", , {"error_logger",
sc(atom(), sc(atom(),
#{mapping => "kernel.error_logger", #{mapping => "kernel.error_logger",
default => silent, default => silent,
desc => "Deprecated." desc => ?DESC("log_error_logger")
})} })}
]; ];
@ -676,7 +676,7 @@ fields("console_handler") ->
fields("log_file_handler") -> fields("log_file_handler") ->
[ {"file", [ {"file",
sc(file(), sc(file(),
#{ desc => "Name the log file." #{ desc => ?DESC("log_file_handler_file")
})} })}
, {"rotation", , {"rotation",
sc(ref("log_rotation"), sc(ref("log_rotation"),
@ -684,9 +684,7 @@ fields("log_file_handler") ->
, {"max_size", , {"max_size",
sc(hoconsc:union([infinity, emqx_schema:bytesize()]), sc(hoconsc:union([infinity, emqx_schema:bytesize()]),
#{ default => "10MB" #{ default => "10MB"
, desc => "This parameter controls log file rotation. " , desc => ?DESC("log_file_handler_max_size")
"The value `infinity` means the log file will grow indefinitely, "
"otherwise the log file will be rotated once it reaches `max_size` in bytes."
})} })}
] ++ log_handler_common_confs(); ] ++ log_handler_common_confs();
@ -694,12 +692,12 @@ fields("log_rotation") ->
[ {"enable", [ {"enable",
sc(boolean(), sc(boolean(),
#{ default => true #{ default => true
, desc => "Enable log rotation feature." , desc => ?DESC("log_rotation_enable")
})} })}
, {"count", , {"count",
sc(range(1, 2048), sc(range(1, 2048),
#{ default => 10 #{ default => 10
, desc => "Maximum number of log files." , desc => ?DESC("log_rotation_count")
})} })}
]; ];
@ -707,23 +705,22 @@ fields("log_overload_kill") ->
[ {"enable", [ {"enable",
sc(boolean(), sc(boolean(),
#{ default => true #{ default => true
, desc => "Enable log handler overload kill feature." , desc => ?DESC("log_overload_kill_enable")
})} })}
, {"mem_size", , {"mem_size",
sc(emqx_schema:bytesize(), sc(emqx_schema:bytesize(),
#{ default => "30MB" #{ default => "30MB"
, desc => "Maximum memory size that the handler process is allowed to use." , desc => ?DESC("log_overload_kill_mem_size")
})} })}
, {"qlen", , {"qlen",
sc(integer(), sc(integer(),
#{ default => 20000 #{ default => 20000
, desc => "Maximum allowed queue length." , desc => ?DESC("log_overload_kill_qlen")
})} })}
, {"restart_after", , {"restart_after",
sc(hoconsc:union([emqx_schema:duration(), infinity]), sc(hoconsc:union([emqx_schema:duration(), infinity]),
#{ default => "5s" #{ default => "5s"
, desc => "If the handler is terminated, it restarts automatically after a " , desc => ?DESC("log_overload_kill_restart_after")
"delay specified in milliseconds. The value `infinity` prevents restarts."
})} })}
]; ];
@ -731,19 +728,17 @@ fields("log_burst_limit") ->
[ {"enable", [ {"enable",
sc(boolean(), sc(boolean(),
#{ default => true #{ default => true
, desc => "Enable log burst control feature." , desc => ?DESC("log_burst_limit_enable")
})} })}
, {"max_count", , {"max_count",
sc(integer(), sc(integer(),
#{ default => 10000 #{ default => 10000
, desc => "Maximum number of log events to handle within a `window_time` interval. " , desc => ?DESC("log_burst_limit_max_count")
"After the limit is reached, successive events are dropped "
"until the end of the `window_time`."
})} })}
, {"window_time", , {"window_time",
sc(emqx_schema:duration(), sc(emqx_schema:duration(),
#{ default => "1s" #{ default => "1s"
, desc => "See `max_count`." , desc => ?DESC("log_burst_limit_window_time")
})} })}
]; ];
@ -751,59 +746,40 @@ fields("authorization") ->
emqx_schema:fields("authorization") ++ emqx_schema:fields("authorization") ++
emqx_authz_schema:fields("authorization"). emqx_authz_schema:fields("authorization").
desc("cluster") -> desc("cluster") ->
"EMQX nodes can form a cluster to scale up the total capacity.<br>" ?DESC("desc_cluster");
"Here holds the configs to instruct how individual nodes "
"can discover each other.";
desc(cluster_static) -> desc(cluster_static) ->
"Service discovery via static nodes. The new node joins the cluster by " ?DESC("desc_cluster_static");
"connecting to one of the bootstrap nodes.";
desc(cluster_mcast) -> desc(cluster_mcast) ->
"Service discovery via UDP multicast."; ?DESC("desc_cluster_mcast");
desc(cluster_dns) -> desc(cluster_dns) ->
"Service discovery via DNS SRV records."; ?DESC("desc_cluster_dns");
desc(cluster_etcd) -> desc(cluster_etcd) ->
"Service discovery using 'etcd' service."; ?DESC("desc_cluster_etcd");
desc(cluster_k8s) -> desc(cluster_k8s) ->
"Service discovery via Kubernetes API server."; ?DESC("desc_cluster_k8s");
desc("node") -> desc("node") ->
"Node name, cookie, config & data directories " ?DESC("desc_node");
"and the Erlang virtual machine (BEAM) boot parameters.";
desc("db") -> desc("db") ->
"Settings for the embedded database."; ?DESC("desc_db");
desc("cluster_call") -> desc("cluster_call") ->
"Options for the 'cluster call' feature that allows to execute a callback " ?DESC("desc_cluster_call");
"on all nodes in the cluster.";
desc("rpc") -> desc("rpc") ->
"EMQX uses a library called <code>gen_rpc</code> for " ?DESC("desc_rpc");
"inter-broker communication.<br/>Most of the time the default config "
"should work, but in case you need to do performance "
"fine-tuning or experiment a bit, this is where to look.";
desc("log") -> desc("log") ->
"EMQX logging supports multiple sinks for the log events." ?DESC("desc_log");
" Each sink is represented by a _log handler_, which can be configured independently.";
desc("console_handler") -> desc("console_handler") ->
"Log handler that prints log events to the EMQX console."; ?DESC("desc_console_handler");
desc("log_file_handler") -> desc("log_file_handler") ->
"Log handler that prints log events to files."; ?DESC("desc_log_file_handler");
desc("log_rotation") -> desc("log_rotation") ->
"By default, the logs are stored in `./log` directory (for installation from zip file)" ?DESC("desc_log_rotation");
" or in `/var/log/emqx` (for binary installation).<br/>"
"This section of the configuration controls the number of files kept for each log handler.";
desc("log_overload_kill") -> desc("log_overload_kill") ->
"Log overload kill features an overload protection that activates when" ?DESC("desc_log_overload_kill");
" the log handlers use too much memory or have too many buffered log messages.<br/>"
"When the overload is detected, the log handler is terminated and restarted after a"
" cooldown period.";
desc("log_burst_limit") -> desc("log_burst_limit") ->
"Large bursts of log events produced in a short time can potentially cause problems, such as:\n" ?DESC("desc_log_burst_limit");
" - Log files grow very large\n"
" - Log files are rotated too quickly, and useful information gets overwritten\n"
" - Overall performance impact on the system\n\n"
"Log burst limit feature can temporarily disable logging to avoid these issues.";
desc("authorization") -> desc("authorization") ->
"Settings that control client authorization."; ?DESC("desc_authorization");
desc(_) -> desc(_) ->
undefined. undefined.
@ -913,57 +889,47 @@ log_handler_common_confs() ->
[ {"enable", [ {"enable",
sc(boolean(), sc(boolean(),
#{ default => false #{ default => false
, desc => "Enable this log handler." , desc => ?DESC("log_file_handler_enable")
})} })}
, {"level", , {"level",
sc(log_level(), sc(log_level(),
#{ default => warning #{ default => warning
, desc => "Global log level. This includes the primary log level " , desc => ?DESC("log_file_handler_level")
"and all log handlers."
})} })}
, {"time_offset", , {"time_offset",
sc(string(), sc(string(),
#{ default => "system" #{ default => "system"
, desc => "The time offset to be used when formatting the timestamp." , desc => ?DESC("log_file_handler_time_offset")
})} })}
, {"chars_limit", , {"chars_limit",
sc(hoconsc:union([unlimited, range(1, inf)]), sc(hoconsc:union([unlimited, range(1, inf)]),
#{ default => unlimited #{ default => unlimited
, desc => "Set the maximum length of a single log message. " , desc => ?DESC("log_file_handler_chars_limit")
"If this length is exceeded, the log message will be truncated."
})} })}
, {"formatter", , {"formatter",
sc(hoconsc:enum([text, json]), sc(hoconsc:enum([text, json]),
#{ default => text #{ default => text
, desc => "Choose log format. <code>text</code> for free text, and " , desc => ?DESC("log_file_handler_formatter")
"<code>json</code> for structured logging."
})} })}
, {"single_line", , {"single_line",
sc(boolean(), sc(boolean(),
#{ default => true #{ default => true
, desc => "Print logs in a single line if set to true. " , desc => ?DESC("log_file_handler_single_line")
"Otherwise, log messages may span multiple lines."
})} })}
, {"sync_mode_qlen", , {"sync_mode_qlen",
sc(integer(), sc(integer(),
#{ default => 100 #{ default => 100
, desc => "As long as the number of buffered log events is lower than this value, " , desc => ?DESC("log_file_handler_sync_mode_qlen")
"all log events are handled asynchronously."
})} })}
, {"drop_mode_qlen", , {"drop_mode_qlen",
sc(integer(), sc(integer(),
#{ default => 3000 #{ default => 3000
, desc => "When the number of buffered log events is larger than this value, " , desc => ?DESC("log_file_handler_drop_mode_qlen")
"the new log events are dropped.<br/>"
"When drop mode is activated or deactivated, a message is printed in "
"the logs."
})} })}
, {"flush_qlen", , {"flush_qlen",
sc(integer(), sc(integer(),
#{ default => 8000 #{ default => 8000
, desc => "If the number of buffered log events grows larger than this threshold, " , desc => ?DESC("log_file_handler_flush_qlen")
"a flush (delete) operation takes place. "
"To flush events, the handler discards the buffered log messages without logging."
})} })}
, {"overload_kill", , {"overload_kill",
sc(ref("log_overload_kill"), #{})} sc(ref("log_overload_kill"), #{})}
@ -972,15 +938,12 @@ log_handler_common_confs() ->
, {"supervisor_reports", , {"supervisor_reports",
sc(hoconsc:enum([error, progress]), sc(hoconsc:enum([error, progress]),
#{ default => error #{ default => error
, desc => "Type of supervisor reports that are logged.\n" , desc => ?DESC("log_file_handler_supervisor_reports")
" - `error`: only log errors in the Erlang processes.\n"
" - `progress`: log process startup."
})} })}
, {"max_depth", , {"max_depth",
sc(hoconsc:union([unlimited, non_neg_integer()]), sc(hoconsc:union([unlimited, non_neg_integer()]),
#{ default => 100 #{ default => 100
, desc => "Maximum depth for Erlang term log formatting " , desc => ?DESC("log_file_handler_max_depth")
"and Erlang process message queue inspection."
})} })}
]. ].

View File

@ -3,7 +3,7 @@ emqx_connector_schema_lib {
ssl { ssl {
desc { desc {
en: "SSL connection settings." en: "SSL connection settings."
zh: "SSL 连接设置。" zh: "启用 SSL 连接。"
} }
label: { label: {
en: "Enable SSL" en: "Enable SSL"