forked from apache/logging-log4j2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'doc/2.x/filters' into 2.x
- Loading branch information
Showing
43 changed files
with
2,463 additions
and
918 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/site/antora/modules/ROOT/examples/manual/filters/ContextMapFilter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"Configuration": { | ||
"monitorInterval": 10, | ||
"Appenders": { | ||
"Console": { | ||
"name": "CONSOLE", | ||
"JsonTemplateLayout": {} | ||
} | ||
}, | ||
"Loggers": { | ||
"Root": { | ||
"level": "ALL", | ||
"AppenderRef": { | ||
"ref": "CONSOLE" | ||
} | ||
} | ||
}, | ||
// tag::filter[] | ||
"ContextMapFilter": { | ||
"operator": "AND", | ||
"KeyValuePair": [ | ||
{ | ||
"key": "clientId", | ||
"value": "1234" | ||
}, | ||
{ | ||
"key": "userId", | ||
"value": "alice" | ||
}, | ||
{ | ||
"key": "userId", | ||
"value": "bob" | ||
} | ||
] | ||
} | ||
// end::filter[] | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/site/antora/modules/ROOT/examples/manual/filters/ContextMapFilter.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
monitorInterval = 10 | ||
|
||
appender.0.type = Console | ||
appender.0.name = CONSOLE | ||
appender.0.layout.type = JsonTemplateLayout | ||
|
||
rootLogger.level = ALL | ||
rootLogger.appenderRef.0.ref = CONSOLE | ||
|
||
# tag::filter[] | ||
filter.0.type = ContextMapFilter | ||
filter.0.operator = AND | ||
|
||
filter.0.kv0.type = KeyValuePair | ||
filter.0.kv0.key = clientId | ||
filter.0.kv0.value = 1234 | ||
|
||
filter.0.kv1.type = KeyValuePair | ||
filter.0.kv1.key = userId | ||
filter.0.kv1.value = alice | ||
|
||
filter.0.kv2.type = KeyValuePair | ||
filter.0.kv2.key = userId | ||
filter.0.kv2.value = bob | ||
# end::filter[] |
42 changes: 42 additions & 0 deletions
42
src/site/antora/modules/ROOT/examples/manual/filters/ContextMapFilter.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to you under the Apache License, Version 2.0 | ||
~ (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
<Configuration xmlns="https://logging.apache.org/xml/ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation=" | ||
https://logging.apache.org/xml/ns | ||
https://logging.apache.org/xml/ns/log4j-config-2.xsd" | ||
monitorInterval="10"> | ||
<Appenders> | ||
<Console name="CONSOLE"> | ||
<JsonTemplateLayout/> | ||
</Console> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="ALL"> | ||
<AppenderRef ref="CONSOLE"/> | ||
</Root> | ||
</Loggers> | ||
<!-- tag::filter[] --> | ||
<ContextMapFilter operator="AND"> | ||
<!-- tag::kvp[] --> | ||
<KeyValuePair key="clientId" value="1234"/> | ||
<KeyValuePair key="userId" value="alice"/> | ||
<KeyValuePair key="userId" value="bob"/> | ||
<!-- end::kvp[] --> | ||
</ContextMapFilter> | ||
<!-- end::filter[] --> | ||
</Configuration> |
38 changes: 38 additions & 0 deletions
38
src/site/antora/modules/ROOT/examples/manual/filters/ContextMapFilter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
Configuration: | ||
monitorInterval: 10 | ||
Appenders: | ||
Console: | ||
name: "CONSOLE" | ||
JsonTemplateLayout: { } | ||
Loggers: | ||
Root: | ||
level: "ALL" | ||
AppenderRef: | ||
ref: "CONSOLE" | ||
# tag::filter[] | ||
ContextMapFilter: | ||
operator: "AND" | ||
KeyValuePair: | ||
- key: "clientId" | ||
value: "1234" | ||
- key: "userId" | ||
value: "alice" | ||
- key: "userId" | ||
value: "bob" | ||
# end::filter[] |
35 changes: 35 additions & 0 deletions
35
src/site/antora/modules/ROOT/examples/manual/filters/DynamicThresholdFilter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"Configuration": { | ||
"monitorInterval": 10, | ||
"Appenders": { | ||
"Console": { | ||
"name": "CONSOLE", | ||
"JsonTemplateLayout": {} | ||
} | ||
}, | ||
"Loggers": { | ||
"Root": { | ||
"level": "ALL", | ||
"AppenderRef": { | ||
"ref": "CONSOLE" | ||
} | ||
} | ||
}, | ||
// tag::filter[] | ||
"DynamicThresholdFilter": { | ||
"key": "loginId", // <3> | ||
"defaultThreshold": "ERROR", | ||
"KeyValuePair": [ | ||
{ // <1> | ||
"key": "alice", | ||
"value": "DEBUG" | ||
}, | ||
{ // <2> | ||
"key": "bob", | ||
"value": "INFO" | ||
} | ||
] | ||
} | ||
// end::filter[] | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/site/antora/modules/ROOT/examples/manual/filters/DynamicThresholdFilter.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
monitorInterval = 10 | ||
|
||
appender.0.type = Console | ||
appender.0.name = CONSOLE | ||
appender.0.layout.type = JsonTemplateLayout | ||
|
||
rootLogger.level = ALL | ||
rootLogger.appenderRef.0.ref = CONSOLE | ||
|
||
# tag::filter[] | ||
filter.0.type = DynamicThresholdFilter | ||
filter.0.key = loginId | ||
# <3> | ||
filter.0.defaultThreshold = ERROR | ||
# <1> | ||
filter.0.kv0.type = KeyValuePair | ||
filter.0.kv0.key = alice | ||
filter.0.kv0.value = DEBUG | ||
# <2> | ||
filter.0.kv1.type = KeyValuePair | ||
filter.0.kv1.key = bob | ||
filter.0.kv1.value = INFO | ||
# end::filter[] |
40 changes: 40 additions & 0 deletions
40
src/site/antora/modules/ROOT/examples/manual/filters/DynamicThresholdFilter.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to you under the Apache License, Version 2.0 | ||
~ (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
<Configuration xmlns="https://logging.apache.org/xml/ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation=" | ||
https://logging.apache.org/xml/ns | ||
https://logging.apache.org/xml/ns/log4j-config-2.xsd" | ||
monitorInterval="10"> | ||
<Appenders> | ||
<Console name="CONSOLE"> | ||
<JsonTemplateLayout/> | ||
</Console> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="ALL"> | ||
<AppenderRef ref="CONSOLE"/> | ||
</Root> | ||
</Loggers> | ||
<!-- tag::filter[] --> | ||
<DynamicThresholdFilter key="loginId" | ||
defaultThreshold="ERROR"> <!--3--> | ||
<KeyValuePair key="alice" value="DEBUG"/> <!--1--> | ||
<KeyValuePair key="bob" value="INFO"/> <!--2--> | ||
</DynamicThresholdFilter> | ||
<!-- end::filter[] --> | ||
</Configuration> |
37 changes: 37 additions & 0 deletions
37
src/site/antora/modules/ROOT/examples/manual/filters/DynamicThresholdFilter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to you under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
Configuration: | ||
monitorInterval: 10 | ||
Appenders: | ||
Console: | ||
name: "CONSOLE" | ||
JsonTemplateLayout: { } | ||
Loggers: | ||
Root: | ||
level: "ALL" | ||
AppenderRef: | ||
ref: "CONSOLE" | ||
# tag::filter[] | ||
DynamicThresholdFilter: | ||
key: "loginId" | ||
defaultThreshold: "ERROR" # <3> | ||
KeyValuePair: | ||
- key: "alice" # <1> | ||
value: "DEBUG" | ||
- key: "bob" # <2> | ||
value: "INFO" | ||
# end::filter[] |
38 changes: 38 additions & 0 deletions
38
src/site/antora/modules/ROOT/examples/manual/filters/MapFilter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"Configuration": { | ||
"monitorInterval": 10, | ||
"Appenders": { | ||
"Console": { | ||
"name": "CONSOLE", | ||
"JsonTemplateLayout": {} | ||
} | ||
}, | ||
"Loggers": { | ||
"Root": { | ||
"level": "ALL", | ||
"AppenderRef": { | ||
"ref": "CONSOLE" | ||
} | ||
} | ||
}, | ||
// tag::filter[] | ||
"MapFilter": { | ||
"operator": "AND", | ||
"KeyValuePair": [ | ||
{ | ||
"key": "eventType", | ||
"value": "authentication" | ||
}, | ||
{ | ||
"key": "eventId", | ||
"value": "login" | ||
}, | ||
{ | ||
"key": "eventId", | ||
"value": "logout" | ||
} | ||
] | ||
} | ||
// end::filter[] | ||
} | ||
} |
Oops, something went wrong.