EverSQL Sensor and Google Cloud SQL Integration

EverSQL Performance Sensor can automatically track your Google Cloud SQL instances performance, to generate actionable AI-powered optimization insights for you.

To integrate EverSQL Sensor with Cloud SQL, please follow these steps.

Enable the slow query log

If you already have slow query logs enabled for your Cloud SQL instance, you can skip to the next section.

To enable slow query logs:

  1. Open Cloud SQL Dashboard
  2. Click Edit on your Database
  3. For MySQL: Add 3 flags (a.k.a. configuration parameters) to your instance:
    • log_output - file / table / none
      We recommend to choose file, which will help you to quickly visualize and analyze your slow query using EverSQL
    • slow_query_log - On/Off
    • long_query_time - number, in seconds.
      For example, 1 means that the log will capture all queries that are longer than 1 second. 0 means capturing all queries.
  4. For PostgreSQL: Add 1 flag (a.k.a. configuration parameters):
    log_min_duration_statement - number, in milliseconds.
    For example, 1000 means that the log will capture all queries that are longer than 1,000 milliseconds (1 second). 0 means capturing all queries.

Create a pipeline from Cloud SQL to a Cloud Storage Bucket

  1. In the GCP Log Router console, click Create Sink and choose a name for the Sink.
  2. Choose Cloud Storage Bucket as the destination, click Browse and create a new bucket to hold the logs.
  3. In the inclusion logs section, please include these filters. Please replace PROJECT_ID and CLOUD_SQL_INSTANCE_NAME with the relevant identifiers from your environment.

    For MySQL:

    resource.type="cloudsql_database"
    resource.labels.database_id="PROJECT_ID:CLOUD_SQL_INSTANCE_NAME"
    log_name="projects/PROJECT_ID/logs/cloudsql.googleapis.com%2Fmysql-slow.log"

    For PostgreSQL:

    resource.type="cloudsql_database"
    resource.labels.database_id="PROJECT_ID:CLOUD_SQL_INSTANCE_NAME"
    log_name="projects/PROJECT_ID/logs/cloudsql.googleapis.com%2Fpostgres.log"

  4. Click Create Sink.

Now that we have the slow query logs redirected, you can start the sensor installation, as described in Step #2 in the sensors installation page.