fix: limit file ^[/\_a-zA-Z0-9\.\-]*$
This commit is contained in:
parent
8cfcb10c7e
commit
a99c49e75f
|
@ -1024,8 +1024,8 @@ all log events are handled asynchronously. This means that the client process se
|
||||||
by calling a log function in the Logger API, does not wait for a response from the handler
|
by calling a log function in the Logger API, does not wait for a response from the handler
|
||||||
but continues executing immediately after the event is sent.
|
but continues executing immediately after the event is sent.
|
||||||
It is not affected by the time it takes the handler to print the event to the log device.
|
It is not affected by the time it takes the handler to print the event to the log device.
|
||||||
If the message queue grows larger than this value, t
|
If the message queue grows larger than this value,
|
||||||
he handler starts handling log events synchronously instead,
|
the handler starts handling log events synchronously instead,
|
||||||
meaning that the client process sending the event must wait for a response.
|
meaning that the client process sending the event must wait for a response.
|
||||||
When the handler reduces the message queue to a level below the sync_mode_qlen threshold,
|
When the handler reduces the message queue to a level below the sync_mode_qlen threshold,
|
||||||
asynchronous operation is resumed.
|
asynchronous operation is resumed.
|
||||||
|
@ -1158,11 +1158,11 @@ When drop mode is activated or deactivated, a message is printed in the logs."""
|
||||||
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: "Log Handler Overload Kill"
|
en: "Log Handler Overload Kill"
|
||||||
zh: "日志处理进程过载终止"
|
zh: "日志处理进程过载保护"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -800,6 +800,7 @@ fields("log") ->
|
||||||
#{
|
#{
|
||||||
mapping => "kernel.error_logger",
|
mapping => "kernel.error_logger",
|
||||||
default => silent,
|
default => silent,
|
||||||
|
readOnly => true,
|
||||||
desc => ?DESC("log_error_logger")
|
desc => ?DESC("log_error_logger")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -811,7 +812,8 @@ fields("log_file_handler") ->
|
||||||
{"file",
|
{"file",
|
||||||
sc(
|
sc(
|
||||||
file(),
|
file(),
|
||||||
#{desc => ?DESC("log_file_handler_file")}
|
#{desc => ?DESC("log_file_handler_file"),
|
||||||
|
validator => fun file_location/1 }
|
||||||
)},
|
)},
|
||||||
{"rotation",
|
{"rotation",
|
||||||
sc(
|
sc(
|
||||||
|
@ -822,7 +824,7 @@ fields("log_file_handler") ->
|
||||||
sc(
|
sc(
|
||||||
hoconsc:union([infinity, emqx_schema:bytesize()]),
|
hoconsc:union([infinity, emqx_schema:bytesize()]),
|
||||||
#{
|
#{
|
||||||
default => "10MB",
|
default => "50MB",
|
||||||
desc => ?DESC("log_file_handler_max_size")
|
desc => ?DESC("log_file_handler_max_size")
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
|
@ -1328,3 +1330,14 @@ emqx_schema_high_prio_roots() ->
|
||||||
#{desc => ?DESC(authorization)}
|
#{desc => ?DESC(authorization)}
|
||||||
)},
|
)},
|
||||||
lists:keyreplace("authorization", 1, Roots, Authz).
|
lists:keyreplace("authorization", 1, Roots, Authz).
|
||||||
|
|
||||||
|
-define(VALID_FILE, "^[/\_a-zA-Z0-9\.\-]*$").
|
||||||
|
file_location(File) ->
|
||||||
|
Error = {error, "Invalid file name: " ++ ?VALID_FILE},
|
||||||
|
try
|
||||||
|
case re:run(File, ?VALID_FILE) of
|
||||||
|
nomatch -> Error;
|
||||||
|
_ -> ok
|
||||||
|
end
|
||||||
|
catch _:_ -> Error
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue