fix(trace): delete duplicate topic from msg
This commit is contained in:
parent
04313dc044
commit
b8bb5ff738
File diff suppressed because it is too large
Load Diff
|
@ -63,12 +63,12 @@
|
||||||
|
|
||||||
%% structured logging, meta is for handler's filter.
|
%% structured logging, meta is for handler's filter.
|
||||||
-define(SLOG(Level, Data, Meta),
|
-define(SLOG(Level, Data, Meta),
|
||||||
%% check 'allow' here, only evaluate Data when necessary
|
%% check 'allow' here, only evaluate Data and Meta when necessary
|
||||||
case logger:allow(Level, ?MODULE) of
|
case logger:allow(Level, ?MODULE) of
|
||||||
true ->
|
true ->
|
||||||
logger:log(Level, (Data), Meta#{ mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY}
|
logger:log(Level, (Data), (Meta#{ mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY}
|
||||||
, line => ?LINE
|
, line => ?LINE
|
||||||
});
|
}));
|
||||||
false ->
|
false ->
|
||||||
ok
|
ok
|
||||||
end).
|
end).
|
||||||
|
|
|
@ -550,7 +550,6 @@ process_publish(Packet = ?PUBLISH_PACKET(QoS, Topic, PacketId), Channel) ->
|
||||||
{error, Rc = ?RC_NOT_AUTHORIZED, NChannel} ->
|
{error, Rc = ?RC_NOT_AUTHORIZED, NChannel} ->
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
msg => "cannot_publish_to_topic",
|
msg => "cannot_publish_to_topic",
|
||||||
topic => Topic,
|
|
||||||
reason => emqx_reason_codes:name(Rc)
|
reason => emqx_reason_codes:name(Rc)
|
||||||
}, #{topic => Topic}),
|
}, #{topic => Topic}),
|
||||||
case emqx:get_config([authorization, deny_action], ignore) of
|
case emqx:get_config([authorization, deny_action], ignore) of
|
||||||
|
@ -568,7 +567,6 @@ process_publish(Packet = ?PUBLISH_PACKET(QoS, Topic, PacketId), Channel) ->
|
||||||
{error, Rc = ?RC_QUOTA_EXCEEDED, NChannel} ->
|
{error, Rc = ?RC_QUOTA_EXCEEDED, NChannel} ->
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
msg => "cannot_publish_to_topic",
|
msg => "cannot_publish_to_topic",
|
||||||
topic => Topic,
|
|
||||||
reason => emqx_reason_codes:name(Rc)
|
reason => emqx_reason_codes:name(Rc)
|
||||||
}, #{topic => Topic}),
|
}, #{topic => Topic}),
|
||||||
case QoS of
|
case QoS of
|
||||||
|
|
|
@ -455,8 +455,7 @@ kick_session(Action, ClientId, ChanPid) ->
|
||||||
kick_session(ClientId) ->
|
kick_session(ClientId) ->
|
||||||
case lookup_channels(ClientId) of
|
case lookup_channels(ClientId) of
|
||||||
[] ->
|
[] ->
|
||||||
?SLOG(warning, #{msg => "kicked_an_unknown_session",
|
?SLOG(warning, #{msg => "kicked_an_unknown_session"},
|
||||||
clientid => ClientId},
|
|
||||||
#{clientid => unicode:characters_to_list(ClientId, utf8)}),
|
#{clientid => unicode:characters_to_list(ClientId, utf8)}),
|
||||||
ok;
|
ok;
|
||||||
ChanPids ->
|
ChanPids ->
|
||||||
|
|
|
@ -118,7 +118,6 @@ handle_cast({detected, #flapping{clientid = ClientId,
|
||||||
true -> %% Flapping happened:(
|
true -> %% Flapping happened:(
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
msg => "flapping_detected",
|
msg => "flapping_detected",
|
||||||
client_id => ClientId,
|
|
||||||
peer_host => fmt_host(PeerHost),
|
peer_host => fmt_host(PeerHost),
|
||||||
detect_cnt => DetectCnt,
|
detect_cnt => DetectCnt,
|
||||||
wind_time_in_ms => WindTime
|
wind_time_in_ms => WindTime
|
||||||
|
@ -134,7 +133,6 @@ handle_cast({detected, #flapping{clientid = ClientId,
|
||||||
false ->
|
false ->
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
msg => "client_disconnected",
|
msg => "client_disconnected",
|
||||||
client_id => ClientId,
|
|
||||||
peer_host => fmt_host(PeerHost),
|
peer_host => fmt_host(PeerHost),
|
||||||
detect_cnt => DetectCnt,
|
detect_cnt => DetectCnt,
|
||||||
interval => Interval
|
interval => Interval
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
, filter_topic/2
|
, filter_topic/2
|
||||||
, filter_ip_address/2
|
, filter_ip_address/2
|
||||||
]).
|
]).
|
||||||
-export([template/1]).
|
|
||||||
|
|
||||||
-export([handler_id/2]).
|
-export([handler_id/2]).
|
||||||
-export([payload_encode/0]).
|
-export([payload_encode/0]).
|
||||||
|
@ -158,20 +157,6 @@ formatter(#{type := _Type}) ->
|
||||||
}
|
}
|
||||||
}.
|
}.
|
||||||
|
|
||||||
%% Don't log clientid since clientid only supports exact match, all client ids are the same.
|
|
||||||
%% if clientid is not latin characters. the logger_formatter restricts the output must be `~tp`
|
|
||||||
%% (actually should use `~ts`), the utf8 characters clientid will become very difficult to read.
|
|
||||||
template(clientid) ->
|
|
||||||
[time, " [", level, "] ", {peername, [peername, " "], []}, msg, "\n"];
|
|
||||||
template(_) ->
|
|
||||||
[time, " [", level, "] ",
|
|
||||||
{clientid,
|
|
||||||
[{peername, [clientid, "@", peername, " "], [clientid, " "]}],
|
|
||||||
[{peername, [peername, " "], []}]
|
|
||||||
},
|
|
||||||
msg, "\n"
|
|
||||||
].
|
|
||||||
|
|
||||||
filter_traces(#{id := Id, level := Level, dst := Dst, filters := Filters}, Acc) ->
|
filter_traces(#{id := Id, level := Level, dst := Dst, filters := Filters}, Acc) ->
|
||||||
Init = #{id => Id, level => Level, dst => Dst},
|
Init = #{id => Id, level => Level, dst => Dst},
|
||||||
case Filters of
|
case Filters of
|
||||||
|
|
Loading…
Reference in New Issue