Skip to content

Commit

Permalink
Merge branch 'doc/2.x/filters' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Jul 8, 2024
2 parents 9d7cc36 + 641004c commit a184965
Show file tree
Hide file tree
Showing 43 changed files with 2,463 additions and 918 deletions.
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[]
}
}
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[]
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>
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[]
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[]
}
}
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[]
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>
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[]
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[]
}
}
Loading

0 comments on commit a184965

Please sign in to comment.