Merge pull request #11673 from HJianBo/redact_audit_log_from_cli
Redact audit log from CLI
This commit is contained in:
commit
6f29bbf997
|
@ -108,7 +108,17 @@ admins(_) ->
|
|||
emqx_ctl:usage(usage_sync()).
|
||||
|
||||
audit(Level, From, Log) ->
|
||||
?AUDIT(Level, From, Log#{time => logger:timestamp()}).
|
||||
Log1 = redact(Log#{time => logger:timestamp()}),
|
||||
?AUDIT(Level, From, Log1).
|
||||
|
||||
redact(Logs = #{cmd := admins, args := ["add", Username, _Password | Rest]}) ->
|
||||
Logs#{args => ["add", Username, "******" | Rest]};
|
||||
redact(Logs = #{cmd := admins, args := ["passwd", Username, _Password]}) ->
|
||||
Logs#{args => ["passwd", Username, "******"]};
|
||||
redact(Logs = #{cmd := license, args := ["update", _License]}) ->
|
||||
Logs#{args => ["update", "******"]};
|
||||
redact(Logs) ->
|
||||
Logs.
|
||||
|
||||
usage_conf() ->
|
||||
[
|
||||
|
|
Loading…
Reference in New Issue