You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/21 20:58:44 UTC

[activemq-artemis] 22/33: make basic start on audit log file config, add [unfinished] config changes to get AuditLoggerResourceTest smoke test passing

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit d1afdee694798e803fa690489a3581917c429379
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Fri Jul 15 13:59:06 2022 +0100

    make basic start on audit log file config, add [unfinished] config changes to get AuditLoggerResourceTest smoke test passing
---
 .../cli/commands/etc/log4j2-config.properties      | 32 ++++++++++--
 .../servers/audit-logging/log4j2-config.properties | 61 ++++++++++++++++++++++
 2 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties
index 32ba2f9680..bebb6d4b9d 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties
@@ -19,10 +19,19 @@ rootLogger = INFO, Console
 logger.activemq.name=org.apache.activemq
 logger.activemq.level=INFO
 
-# Audit logger:
-logger.audit.name=org.apache.activemq.audit
-logger.audit.level=INFO
-#TODO: copy specific audit loggers config
+# Audit loggers: to enable change levels from OFF to INFO
+logger.audit_base = OFF, audit_log_file
+logger.audit_base.name = org.apache.activemq.audit.base
+logger.audit_base.additivity = false
+
+logger.audit_resource = OFF, audit_log_file
+logger.audit_resource.name = org.apache.activemq.audit.resource
+logger.audit_resource.additivity = false
+
+logger.audit_message = OFF, audit_log_file
+logger.audit_message.name = org.apache.activemq.audit.message
+logger.audit_message.additivity = false
+
 
 # quorum logger levels
 logger.curator.name=org.apache.curator
@@ -34,4 +43,19 @@ logger.zookeeper.level=ERROR
 appender.console.type=Console
 appender.console.name=Console
 appender.console.layout.type=PatternLayout
+#TODO: look at old/previous pattern and align
 appender.console.layout.pattern=[%t] %d{HH:mm:ss,SSS} %-5level [%logger] %msg%n
+
+# Audit log file appender
+appender.audit_log_file.type = RollingFile
+appender.audit_log_file.name = audit_log_file
+appender.audit_log_file.fileName = ${sys:artemis.instance}/log/audit.log
+#TODO: look at old/previous filename pattern and behaviour and align
+appender.audit_log_file.filePattern = ${sys:artemis.instance}/log/audit-%d{yyyy-MM-dd}.log
+appender.audit_log_file.layout.type = PatternLayout
+appender.audit_log_file.layout.pattern = [%t] %d{HH:mm:ss,SSS} %-5level [%logger] %msg%n
+#TODO: look at old/previous pattern and align
+appender.audit_log_file.policies.type = Policies
+appender.audit_log_file.policies.time.type = TimeBasedTriggeringPolicy
+appender.audit_log_file.policies.time.interval = 24
+appender.audit_log_file.policies.time.modulate = true
diff --git a/tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2-config.properties b/tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2-config.properties
new file mode 100644
index 0000000000..7084e749ef
--- /dev/null
+++ b/tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2-config.properties
@@ -0,0 +1,61 @@
+# 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.
+
+# Log4J 2 configuration
+rootLogger = INFO, Console
+
+logger.activemq.name=org.apache.activemq
+logger.activemq.level=INFO
+
+# Audit loggers: to enable change levels from OFF to INFO
+logger.audit_base = INFO, audit_log_file
+logger.audit_base.name = org.apache.activemq.audit.base
+logger.audit_base.additivity = false
+
+logger.audit_resource = INFO, audit_log_file
+logger.audit_resource.name = org.apache.activemq.audit.resource
+logger.audit_resource.additivity = false
+
+logger.audit_message = INFO, audit_log_file
+logger.audit_message.name = org.apache.activemq.audit.message
+logger.audit_message.additivity = false
+
+
+# quorum logger levels
+logger.curator.name=org.apache.curator
+logger.curator.level=WARN
+logger.zookeeper.name=org.apache.zookeeper
+logger.zookeeper.level=ERROR
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+#TODO: look at old/previous pattern and align
+appender.console.layout.pattern=[%t] %d{HH:mm:ss,SSS} %-5level [%logger] %msg%n
+
+# Audit log file appender
+appender.audit_log_file.type = RollingFile
+appender.audit_log_file.name = audit_log_file
+appender.audit_log_file.fileName = ${sys:artemis.instance}/log/audit.log
+#TODO: look at old/previous filename pattern and behaviour and align
+appender.audit_log_file.filePattern = ${sys:artemis.instance}/log/audit-%d{yyyy-MM-dd}.log
+appender.audit_log_file.layout.type = PatternLayout
+appender.audit_log_file.layout.pattern = [%t] %d{HH:mm:ss,SSS} %-5level [%logger] %msg%n
+#TODO: look at old/previous pattern and align
+appender.audit_log_file.policies.type = Policies
+appender.audit_log_file.policies.time.type = TimeBasedTriggeringPolicy
+appender.audit_log_file.policies.time.interval = 24
+appender.audit_log_file.policies.time.modulate = true