How to enable slow query and general logs for Aurora Serverless

How to enable slow query and general logs for Aurora Serverless

During a project we are migrating a lot of MySQL RDS instances to Aurora Serverless basically to lower runtime and operational cost (OPEX).

In the traditional Aurora / MySQL RDS Cluster you could see logging on RDS instance level and also view/download them through the console. However for Aurora Serverless this feature is missing.

To enable general and slow query logs you can however set the following value in a custom attached DBClusterParameterGroup.

  DBClusterParameterGroup:
    Type: AWS::RDS::DBClusterParameterGroup
    Properties:
      Description: !Sub 'terra10-${ENV}-parametergroup'
      Family: aurora5.6
      Parameters:
        general_log: '1'
        slow_query_log: '1'
      Tags:
        - Key: Name
          Value: !Sub 'terra10-${ENV}-parametergroup'

In AWS CloudWatch the  error logstream is always there by default:

/aws/rds/cluster/t10-tst/error
/aws/rds/cluster/t10-tst/general
/aws/rds/cluster/t10-tst/slowquery

But thanks to the added parameters both the general and slowquery logstreams should appear on respectively their first new log event.

Hope it helps.