Sfoglia il codice sorgente

fix(trace): delete duplicate topic from msg

zhongwencool 4 anni fa
parent
commit
b8bb5ff738

File diff suppressed because it is too large
+ 0 - 1671
apps/emqx/etc/emqx.conf.rendered


+ 3 - 3
apps/emqx/include/logger.hrl

@@ -63,12 +63,12 @@
 
 %% structured logging, meta is for handler's filter.
 -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
         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
-            });
+            }));
         false ->
             ok
     end).

+ 0 - 2
apps/emqx/src/emqx_channel.erl

@@ -550,7 +550,6 @@ process_publish(Packet = ?PUBLISH_PACKET(QoS, Topic, PacketId), Channel) ->
         {error, Rc = ?RC_NOT_AUTHORIZED, NChannel} ->
             ?SLOG(warning, #{
                 msg => "cannot_publish_to_topic",
-                topic => Topic,
                 reason => emqx_reason_codes:name(Rc)
             }, #{topic => Topic}),
             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} ->
             ?SLOG(warning, #{
                 msg => "cannot_publish_to_topic",
-                topic => Topic,
                 reason => emqx_reason_codes:name(Rc)
             }, #{topic => Topic}),
             case QoS of

+ 1 - 2
apps/emqx/src/emqx_cm.erl

@@ -455,8 +455,7 @@ kick_session(Action, ClientId, ChanPid) ->
 kick_session(ClientId) ->
     case lookup_channels(ClientId) of
         [] ->
-            ?SLOG(warning, #{msg => "kicked_an_unknown_session",
-                             clientid => ClientId},
+            ?SLOG(warning, #{msg => "kicked_an_unknown_session"},
                 #{clientid => unicode:characters_to_list(ClientId, utf8)}),
             ok;
         ChanPids ->

+ 0 - 2
apps/emqx/src/emqx_flapping.erl

@@ -118,7 +118,6 @@ handle_cast({detected, #flapping{clientid   = ClientId,
         true -> %% Flapping happened:(
             ?SLOG(warning, #{
                 msg => "flapping_detected",
-                client_id => ClientId,
                 peer_host => fmt_host(PeerHost),
                 detect_cnt => DetectCnt,
                 wind_time_in_ms => WindTime
@@ -134,7 +133,6 @@ handle_cast({detected, #flapping{clientid   = ClientId,
         false ->
             ?SLOG(warning, #{
                 msg => "client_disconnected",
-                client_id => ClientId,
                 peer_host => fmt_host(PeerHost),
                 detect_cnt => DetectCnt,
                 interval => Interval

+ 0 - 15
apps/emqx/src/emqx_trace/emqx_trace_handler.erl

@@ -35,7 +35,6 @@
         , filter_topic/2
         , filter_ip_address/2
         ]).
--export([template/1]).
 
 -export([handler_id/2]).
 -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) ->
     Init = #{id => Id, level => Level, dst => Dst},
     case Filters of