Skip to content

Commit a184965

Browse files
committed
Merge branch 'doc/2.x/filters' into 2.x
2 parents 9d7cc36 + 641004c commit a184965

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2463
-918
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"Configuration": {
3+
"monitorInterval": 10,
4+
"Appenders": {
5+
"Console": {
6+
"name": "CONSOLE",
7+
"JsonTemplateLayout": {}
8+
}
9+
},
10+
"Loggers": {
11+
"Root": {
12+
"level": "ALL",
13+
"AppenderRef": {
14+
"ref": "CONSOLE"
15+
}
16+
}
17+
},
18+
// tag::filter[]
19+
"ContextMapFilter": {
20+
"operator": "AND",
21+
"KeyValuePair": [
22+
{
23+
"key": "clientId",
24+
"value": "1234"
25+
},
26+
{
27+
"key": "userId",
28+
"value": "alice"
29+
},
30+
{
31+
"key": "userId",
32+
"value": "bob"
33+
}
34+
]
35+
}
36+
// end::filter[]
37+
}
38+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
monitorInterval = 10
18+
19+
appender.0.type = Console
20+
appender.0.name = CONSOLE
21+
appender.0.layout.type = JsonTemplateLayout
22+
23+
rootLogger.level = ALL
24+
rootLogger.appenderRef.0.ref = CONSOLE
25+
26+
# tag::filter[]
27+
filter.0.type = ContextMapFilter
28+
filter.0.operator = AND
29+
30+
filter.0.kv0.type = KeyValuePair
31+
filter.0.kv0.key = clientId
32+
filter.0.kv0.value = 1234
33+
34+
filter.0.kv1.type = KeyValuePair
35+
filter.0.kv1.key = userId
36+
filter.0.kv1.value = alice
37+
38+
filter.0.kv2.type = KeyValuePair
39+
filter.0.kv2.key = userId
40+
filter.0.kv2.value = bob
41+
# end::filter[]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<Configuration xmlns="https://logging.apache.org/xml/ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="
20+
https://logging.apache.org/xml/ns
21+
https://logging.apache.org/xml/ns/log4j-config-2.xsd"
22+
monitorInterval="10">
23+
<Appenders>
24+
<Console name="CONSOLE">
25+
<JsonTemplateLayout/>
26+
</Console>
27+
</Appenders>
28+
<Loggers>
29+
<Root level="ALL">
30+
<AppenderRef ref="CONSOLE"/>
31+
</Root>
32+
</Loggers>
33+
<!-- tag::filter[] -->
34+
<ContextMapFilter operator="AND">
35+
<!-- tag::kvp[] -->
36+
<KeyValuePair key="clientId" value="1234"/>
37+
<KeyValuePair key="userId" value="alice"/>
38+
<KeyValuePair key="userId" value="bob"/>
39+
<!-- end::kvp[] -->
40+
</ContextMapFilter>
41+
<!-- end::filter[] -->
42+
</Configuration>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
Configuration:
18+
monitorInterval: 10
19+
Appenders:
20+
Console:
21+
name: "CONSOLE"
22+
JsonTemplateLayout: { }
23+
Loggers:
24+
Root:
25+
level: "ALL"
26+
AppenderRef:
27+
ref: "CONSOLE"
28+
# tag::filter[]
29+
ContextMapFilter:
30+
operator: "AND"
31+
KeyValuePair:
32+
- key: "clientId"
33+
value: "1234"
34+
- key: "userId"
35+
value: "alice"
36+
- key: "userId"
37+
value: "bob"
38+
# end::filter[]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"Configuration": {
3+
"monitorInterval": 10,
4+
"Appenders": {
5+
"Console": {
6+
"name": "CONSOLE",
7+
"JsonTemplateLayout": {}
8+
}
9+
},
10+
"Loggers": {
11+
"Root": {
12+
"level": "ALL",
13+
"AppenderRef": {
14+
"ref": "CONSOLE"
15+
}
16+
}
17+
},
18+
// tag::filter[]
19+
"DynamicThresholdFilter": {
20+
"key": "loginId", // <3>
21+
"defaultThreshold": "ERROR",
22+
"KeyValuePair": [
23+
{ // <1>
24+
"key": "alice",
25+
"value": "DEBUG"
26+
},
27+
{ // <2>
28+
"key": "bob",
29+
"value": "INFO"
30+
}
31+
]
32+
}
33+
// end::filter[]
34+
}
35+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
monitorInterval = 10
18+
19+
appender.0.type = Console
20+
appender.0.name = CONSOLE
21+
appender.0.layout.type = JsonTemplateLayout
22+
23+
rootLogger.level = ALL
24+
rootLogger.appenderRef.0.ref = CONSOLE
25+
26+
# tag::filter[]
27+
filter.0.type = DynamicThresholdFilter
28+
filter.0.key = loginId
29+
# <3>
30+
filter.0.defaultThreshold = ERROR
31+
# <1>
32+
filter.0.kv0.type = KeyValuePair
33+
filter.0.kv0.key = alice
34+
filter.0.kv0.value = DEBUG
35+
# <2>
36+
filter.0.kv1.type = KeyValuePair
37+
filter.0.kv1.key = bob
38+
filter.0.kv1.value = INFO
39+
# end::filter[]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<Configuration xmlns="https://logging.apache.org/xml/ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="
20+
https://logging.apache.org/xml/ns
21+
https://logging.apache.org/xml/ns/log4j-config-2.xsd"
22+
monitorInterval="10">
23+
<Appenders>
24+
<Console name="CONSOLE">
25+
<JsonTemplateLayout/>
26+
</Console>
27+
</Appenders>
28+
<Loggers>
29+
<Root level="ALL">
30+
<AppenderRef ref="CONSOLE"/>
31+
</Root>
32+
</Loggers>
33+
<!-- tag::filter[] -->
34+
<DynamicThresholdFilter key="loginId"
35+
defaultThreshold="ERROR"> <!--3-->
36+
<KeyValuePair key="alice" value="DEBUG"/> <!--1-->
37+
<KeyValuePair key="bob" value="INFO"/> <!--2-->
38+
</DynamicThresholdFilter>
39+
<!-- end::filter[] -->
40+
</Configuration>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
Configuration:
18+
monitorInterval: 10
19+
Appenders:
20+
Console:
21+
name: "CONSOLE"
22+
JsonTemplateLayout: { }
23+
Loggers:
24+
Root:
25+
level: "ALL"
26+
AppenderRef:
27+
ref: "CONSOLE"
28+
# tag::filter[]
29+
DynamicThresholdFilter:
30+
key: "loginId"
31+
defaultThreshold: "ERROR" # <3>
32+
KeyValuePair:
33+
- key: "alice" # <1>
34+
value: "DEBUG"
35+
- key: "bob" # <2>
36+
value: "INFO"
37+
# end::filter[]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"Configuration": {
3+
"monitorInterval": 10,
4+
"Appenders": {
5+
"Console": {
6+
"name": "CONSOLE",
7+
"JsonTemplateLayout": {}
8+
}
9+
},
10+
"Loggers": {
11+
"Root": {
12+
"level": "ALL",
13+
"AppenderRef": {
14+
"ref": "CONSOLE"
15+
}
16+
}
17+
},
18+
// tag::filter[]
19+
"MapFilter": {
20+
"operator": "AND",
21+
"KeyValuePair": [
22+
{
23+
"key": "eventType",
24+
"value": "authentication"
25+
},
26+
{
27+
"key": "eventId",
28+
"value": "login"
29+
},
30+
{
31+
"key": "eventId",
32+
"value": "logout"
33+
}
34+
]
35+
}
36+
// end::filter[]
37+
}
38+
}

0 commit comments

Comments
 (0)