fix: don't need to change audit log's level
This commit is contained in:
parent
1df8326fb8
commit
95060302fd
|
@ -1014,6 +1014,15 @@ fields("log_file_handler") ->
|
||||||
] ++ log_handler_common_confs(file, #{});
|
] ++ log_handler_common_confs(file, #{});
|
||||||
fields("log_audit_handler") ->
|
fields("log_audit_handler") ->
|
||||||
[
|
[
|
||||||
|
{"level",
|
||||||
|
sc(
|
||||||
|
log_level(),
|
||||||
|
#{
|
||||||
|
default => info,
|
||||||
|
desc => ?DESC("audit_handler_level"),
|
||||||
|
importance => ?IMPORTANCE_HIDDEN
|
||||||
|
}
|
||||||
|
)},
|
||||||
{"path",
|
{"path",
|
||||||
sc(
|
sc(
|
||||||
file(),
|
file(),
|
||||||
|
@ -1047,12 +1056,13 @@ fields("log_audit_handler") ->
|
||||||
)}
|
)}
|
||||||
] ++
|
] ++
|
||||||
%% Only support json
|
%% Only support json
|
||||||
|
lists:keydelete(
|
||||||
|
"level",
|
||||||
|
1,
|
||||||
lists:keydelete(
|
lists:keydelete(
|
||||||
"formatter",
|
"formatter",
|
||||||
1,
|
1,
|
||||||
log_handler_common_confs(
|
log_handler_common_confs(file, #{})
|
||||||
file,
|
|
||||||
#{level => info, level_desc => "audit_handler_level"}
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
fields("log_overload_kill") ->
|
fields("log_overload_kill") ->
|
||||||
|
|
|
@ -350,8 +350,6 @@ audit_log(Level, From, Log) ->
|
||||||
|
|
||||||
-define(TOO_SLOW, 3000).
|
-define(TOO_SLOW, 3000).
|
||||||
|
|
||||||
audit_level(ok, Duration) when Duration >= ?TOO_SLOW -> warning;
|
|
||||||
audit_level({ok, _}, Duration) when Duration >= ?TOO_SLOW -> warning;
|
|
||||||
audit_level(ok, _Duration) -> info;
|
audit_level(ok, _Duration) -> info;
|
||||||
audit_level({ok, _}, _Duration) -> info;
|
audit_level({ok, _}, _Duration) -> info;
|
||||||
audit_level(_, _) -> error.
|
audit_level(_, _) -> error.
|
||||||
|
|
|
@ -43,8 +43,7 @@ from(jwt_token) -> "dashboard";
|
||||||
from(api_key) -> "aip_key";
|
from(api_key) -> "aip_key";
|
||||||
from(_) -> "unauthorized".
|
from(_) -> "unauthorized".
|
||||||
|
|
||||||
level(_, _Code, Duration) when Duration > 3000 -> warning;
|
level(get, _Code, _) -> debug;
|
||||||
level(get, Code, _) when Code >= 200 andalso Code < 300 -> debug;
|
|
||||||
level(_, Code, _) when Code >= 200 andalso Code < 300 -> info;
|
level(_, Code, _) when Code >= 200 andalso Code < 300 -> info;
|
||||||
level(_, Code, _) when Code >= 300 andalso Code < 400 -> warning;
|
level(_, Code, _) when Code >= 300 andalso Code < 400 -> warning;
|
||||||
level(_, Code, _) when Code >= 400 andalso Code < 500 -> error;
|
level(_, Code, _) when Code >= 400 andalso Code < 500 -> error;
|
||||||
|
|
Loading…
Reference in New Issue