Review Amazon MQ broker logging

Collect operational and audit logs appropriate for the broker engine.

Description

Set Logs.General to true to send broker operational logs to CloudWatch Logs. On ActiveMQ, set Logs.Audit to true to record management actions through JMX or the web console. RabbitMQ does not support this audit option.

Potential impact

Audit logs cannot trace every message. Content published from the ActiveMQ web console can appear in logs, so limit who can read them and set a retention period.

Remediation

Grant logs:CreateLogGroup to the IAM identity that creates or reboots the broker. Allow Amazon MQ to deliver logs through the CloudWatch Logs resource policy. Check for a broker event in the general log. If you enable auditing, perform a management action and check its audit entry.

Examples

Both examples enable general logs. Only the second adds audit logs. Use EngineType: ACTIVEMQ with a supported version and instance type, networking, and securely supplied BrokerUsername and BrokerPassword. For ActiveMQ 5.18 or later, set AutoMinorVersionUpgrade to true.

Before

yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: "Create a basic ActiveMQ broker"
Resources:
  BasicBroker:
    Type: "AWS::AmazonMQ::Broker"
    Properties:
      BrokerName: MyBasicBroker
      DeploymentMode: SINGLE_INSTANCE
      EngineType: ActiveMQ
      EngineVersion: "5.15.0"
      HostInstanceType: mq.t2.micro
      PubliclyAccessible: false
      Users:
        - ConsoleAccess: "true"
          Groups:
            - MyGroup
          Password:
            Ref: "BrokerPassword"
          Username:
            Ref: "BrokerUsername"
      Logs:
        General: true

After

yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: "Create a basic ActiveMQ broker"
Resources:
  BasicBroker:
    Type: "AWS::AmazonMQ::Broker"
    Properties:
      AutoMinorVersionUpgrade: "false"
      BrokerName: MyBasicBroker
      DeploymentMode: SINGLE_INSTANCE
      EncryptionOptions:
        UseAwsOwnedKey: true
      EngineType: ActiveMQ
      EngineVersion: "5.15.0"
      HostInstanceType: mq.t2.micro
      PubliclyAccessible: false
      Users:
        - ConsoleAccess: "true"
          Groups:
            - MyGroup
          Password:
            Ref: "BrokerPassword"
          Username:
            Ref: "BrokerUsername"
      Logs:
        General: true
        Audit: true

References