Other Articles

Cloud SQL – Enable Log Export

This check ensures that log export is enabled for Cloud SQL instances. Exporting logs helps with monitoring, troubleshooting, auditing, and detecting suspicious or abnormal database activity.

Check Details

  • Resource: Cloud SQL
  • Check: Configure log export
  • Risk: Without log export, database activity and errors are not centrally recorded, making it difficult to investigate incidents, monitor performance issues, or meet compliance and audit requirements.

Remediation via Google Cloud Console

  1. Log in to the Google Cloud Console and navigate to Cloud SQL. Cloud Sql Instance
  2. Click on the affected Cloud SQL instance.
  3. Click Edit to modify the instance configuration. Cloud Sql Instance Edit
  4. Scroll to the Logs section.
  5. Enable log export for the required log types such as:
    • Database logs
    • Error logs
    • Query logs (if applicable)
    Cloud SQL Log Export
  6. Click Save to apply the changes.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and launch Cloud Shell. GCP Cloud Shell
  2. Enable log export for a Cloud SQL instance:
    
    
    gcloud sql instances patch <INSTANCE_NAME> \
    --enable-cloud-logging
    

Replace <INSTANCE_NAME> with your Cloud SQL instance name. Once enabled, logs will be exported to Cloud Logging and can be viewed or routed to other destinations such as BigQuery or Cloud Storage.

Default Value

By default, log export is not enabled for Cloud SQL instances. Database logs are not centrally available unless log export is explicitly configured.