From d35c100a10239edc669b465a2176000ffcc1300f Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 21 May 2018 16:47:46 +0200 Subject: Change Compare parameter to logger_filters:domain/2 This configuration option has been removed. logger_formatter will read the utc_log configuration parameter and format the timestamp accordingly. --- lib/kernel/doc/src/logger_filters.xml | 145 +++++++++++++++++++++------------- 1 file changed, 92 insertions(+), 53 deletions(-) (limited to 'lib/kernel/doc/src/logger_filters.xml') diff --git a/lib/kernel/doc/src/logger_filters.xml b/lib/kernel/doc/src/logger_filters.xml index 1bbae8be21..f92181ea3f 100644 --- a/lib/kernel/doc/src/logger_filters.xml +++ b/lib/kernel/doc/src/logger_filters.xml @@ -52,61 +52,100 @@ - Filter log events based on the domain field in metadata. + Filter log events based on the domain field in + metadata. -

This filter provides a way of filtering log events based on a - domain field Metadata.

- -

The Extra parameter is specified when - adding the filter - via - logger:add_logger_filter/2 - or - logger:add_handler_filter/3.

- -

The filter compares the value of the domain field - in the log event's metadata (Domain) - to MatchDomain as follows:

- - - Compare = starts_with -

The filter matches if MatchDomain is a prefix - of Domain.

- Compare = prefix_of -

The filter matches if Domain is a prefix - of MatchDomain.

- Compare = equals -

The filter matches if Domain is equal - to MatchDomain.

- Compare = differs -

The filter matches if Domain differs - from MatchDomain, or if there is no domain field - in metadata.

- Compare = no_domain -

The filter matches if there is no domain field in - metadata. In this case MatchDomain shall - be [].

-
- -

If the filter matches and Action = - log, the log event is allowed. If the filter matches - and Action = stop, the log event is - stopped.

- -

If the filter does not match, it returns ignore, - meaning that other filters, or the value of the - configuration parameter filter_default, will decide - if the event is allowed or not.

- -

Log events that do not contain any domain field, will - only match when Compare = no_domain.

- -

Example: stop all events with - domain [beam,erlang,otp,sasl|_]

- - +

This filter provides a way of filtering log events based on a + domain field in Metadata. This field is + optional, and the purpose of using it is to group log events + from, for example, a specific functional area. This allows + filtering or other specialized treatment in a Logger + handler.

+ +

A domain field must be a list of atoms, creating smaller + and more specialized domains as the list grows longer. The + biggest domain is [], which comprices all + possible domains.

+ +

For example, consider the following domains:

+
+D1 = [beam,erlang,otp]
+D2 = [beam,erlang,otp,sasl]
+ +

D1 is the biggest of the two, and is said to be a + super-domain of D2. D2 is a + sub-domain D1. Both D1 and D2 are + sub-domains of []

+ +

The above domains are used for logs originating from + Erlang/OTP. D1 specifies that the log event comes from + Erlang/OTP in general, and D2 indicates that the log event + is a so + called SASL + report.

+ +

The Extra parameter to + the domain/2 function is specified when adding the + filter via + logger:add_logger_filter/2 + or + logger:add_handler_filter/3.

+ +

The filter compares the value of the domain field + in the log event's metadata (Domain) + to MatchDomain as follows:

+ + + Compare = sub + +

The filter matches if Domain is equal to or + a sub-domain of MatchDomain, that is, + if MatchDomain is a prefix of Domain.

+
+ Compare = super + +

The filter matches if Domain is equal to or a + super-domain of MatchDomain, that is, + if Domain is a prefix of MatchDomain.

+
+ Compare = equal + +

The filter matches if Domain is equal + to MatchDomain.

+
+ Compare = not_equal + +

The filter matches if Domain is not equal + to MatchDomain, or if there is no domain field in + metadata.

+
+ Compare = undefined +

The filter matches if there is no domain field in + metadata. In this case MatchDomain + must be set to [].

+
+
+ +

If the filter matches and Action = log, + the log event is allowed. If the filter matches + and Action = stop, the log event is + stopped.

+ +

If the filter does not match, it returns ignore, + meaning that other filters, or the value of the + configuration parameter filter_default, decide if the + event is allowed or not.

+ +

Log events that do not contain any domain field, match only + when Compare = undefined + or Compare = not_equal.

+ +

Example: stop all events with + domain [beam,erlang,otp,sasl|_]

+ + logger:set_handler_config(h1,filter_default,log). % this is the default -Filter = {fun logger_filters:domain/2,{stop,starts_with,[beam,erlang,otp,sasl]}}. +Filter = {fun logger_filters:domain/2,{stop,sub,[beam,erlang,otp,sasl]}}. logger:add_handler_filter(h1,no_sasl,Filter). ok
-- cgit v1.2.3