Merge pull request #11698 from zmstone/0928-disable-audit-log-by-default

fix(audit): disable audit log by default
This commit is contained in:
Zaiming (Stone) Shi 2023-09-28 17:28:23 +02:00 committed by GitHub
commit 36f3052be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -160,7 +160,7 @@ audit_log_conf() ->
%% `emqx_conf:gen_config_md' seems to expect.
desc => ?DESC(emqx_conf_schema, "log_audit_handler"),
importance => ?IMPORTANCE_HIGH,
default => #{<<"enable">> => true, <<"level">> => <<"info">>}
default => #{<<"enable">> => false, <<"level">> => <<"info">>}
}
)}
].

View File

@ -92,7 +92,7 @@ t_audit_log_conf(_Config) ->
#{<<"default">> => FileExpect},
<<"audit">> =>
#{
<<"enable">> => true,
<<"enable">> => false,
<<"level">> => <<"info">>,
<<"path">> => <<"log/audit.log">>,
<<"rotation_count">> => 10,

View File

@ -19,14 +19,14 @@ doc_gen_test() ->
audit_log_test() ->
ensure_acl_conf(),
Conf0 = <<"node {cookie = aaa, data_dir = \"/tmp\"}">>,
Conf0 = <<"node {cookie = aaa, data_dir = \"/tmp\"}, log.audit.enable=true">>,
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
ConfList = hocon_tconf:generate(emqx_enterprise_schema, ConfMap0),
Kernel = proplists:get_value(kernel, ConfList),
Loggers = proplists:get_value(logger, Kernel),
FileHandlers = lists:filter(fun(L) -> element(3, L) =:= logger_disk_log_h end, Loggers),
AuditHandler = lists:keyfind(emqx_audit, 2, FileHandlers),
%% default is enable and log level is info.
%% default log level is info.
?assertMatch(
{handler, emqx_audit, logger_disk_log_h, #{
config := #{