diff --git a/config/log4j.properties b/config/log4j.properties index 0a1ec4f6c1d..3ff3f9e4f6c 100644 --- a/config/log4j.properties +++ b/config/log4j.properties @@ -86,7 +86,7 @@ log4j.additivity.kafka.log.LogCleaner=false log4j.logger.state.change.logger=TRACE, stateChangeAppender log4j.additivity.state.change.logger=false -# Change to DEBUG to enable audit log for the authorizer -log4j.logger.kafka.authorizer.logger=WARN, authorizerAppender +# Access denials are logged at INFO level, change to DEBUG to also log allowed accesses +log4j.logger.kafka.authorizer.logger=INFO, authorizerAppender log4j.additivity.kafka.authorizer.logger=false diff --git a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala index 6218a2c4b2f..3c9496485b9 100644 --- a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala +++ b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala @@ -246,8 +246,13 @@ class SimpleAclAuthorizer extends Authorizer with Logging { } private def logAuditMessage(principal: KafkaPrincipal, authorized: Boolean, operation: Operation, resource: Resource, host: String) { - val permissionType = if (authorized) "Allowed" else "Denied" - authorizerLogger.debug(s"Principal = $principal is $permissionType Operation = $operation from host = $host on resource = $resource") + def logMessage: String = { + val authResult = if (authorized) "Allowed" else "Denied" + s"Principal = $principal is $authResult Operation = $operation from host = $host on resource = $resource" + } + + if (authorized) authorizerLogger.debug(logMessage) + else authorizerLogger.info(logMessage) } /** diff --git a/docs/upgrade.html b/docs/upgrade.html index d265bc937b2..344ef2e896a 100644 --- a/docs/upgrade.html +++ b/docs/upgrade.html @@ -67,6 +67,7 @@ A stub implementation has been retained for binary compatibility.
kafka-consumer-offset-checker.sh
has been removed. Use kafka-consumer-groups.sh
to get consumer group details.