Viewing Information About Your Cloud SQL Instance

This page discusses how to get information about your Google Cloud SQL instances, including instance summary information, usage data, operation logs, and database logs.

Viewing instance summary information

You can view summary information about your Google Cloud SQL instances in the Google Cloud Platform Console, or by using the gcloud command-line tool, or the API.

Console

  1. Go to the Cloud SQL Instances page in the Google Cloud Platform Console.

    Go to the Cloud SQL Instances page

  2. Select an instance to view by clicking the instance name.

    Cloud Platform Console displays the Instance details pane for the instance.

gcloud

gcloud sql instances describe [INSTANCE_NAME]

cURL

ACCESS_TOKEN="$(gcloud auth application-default print-access-token)"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
     -X GET \
     https://www.googleapis.com/sql/v1beta4/projects/[PROJECT-ID]/instances/[INSTANCE_NAME]

Viewing instance usage data in Cloud SQL

Google Cloud SQL provides usage charts of key instance metrics that you can use to monitor your instances. When working with metric data, keep the following facts in mind:

  • A data point for a metric is an aggregate over all of the databases hosted by the instance.
  • Data is reported in Coordinated Universal Time (UTC).
  • Rendered charts do not refresh automatically; to see new data, you must refresh the page.
  • There is a delay of a few minutes between when metric data is recorded and the time it is displayed in the usage charts.

To view instance usage information:

  1. Go to the Cloud SQL Instances page in the Google Cloud Platform Console.

    Go to the Cloud SQL Instances page

  2. Select an instance to view by clicking the instance name.

    The Cloud Platform Console displays the Instance details pane for the instance.

  3. In the metric selection box, select a metric to view its usage chart.

    Screenshot showing dropdown for metric selection.

The usage charts can help you respond proactively as your application needs change. From these metrics, you can gain insight into issues of throughput and latency as well as instance usage costs. The metrics you can see depend on whether your instance is a Second Generation or First Generation instance.

MetricDescription
Storage usage (GB)

You can use the storage usage metric to help you understand your storage costs. For more information about storage usage charges, see Storage and Networking Pricing.

Binary logs use storage space. Binary logs are automatically deleted with their associated automatic backup, which generally happens after about 7 days. You cannot manually delete binary logs, nor change the 7-day time period.

If the size of your binary logs are causing an issue for your instance, you can increase your storage size, but the binary log size increase in binary might be temporary. You can disable and then reenable binary logging, which deletes binary logs. Note, however, that decreasing the storage used does not shrink the size of the storage provisioned for the instance.

A newly created database uses about 100 MB for system tables and files.

CPU usage

You can use this metric to monitor whether your instance has sufficient CPU for your application's needs. If this value is running too high, you can increase the size of your machine type to give your instance more CPU capability.

Memory usage

The amount of memory being used by your instance.

Read/write operations

The Number of Reads metric is the number of read operations served from disk that do not come from cache. You can use this metric to help you understand whether your instance is correctly sized for your environment. If needed, you can move to a larger machine type to serve more requests from cache and reduce latency.

The Number of Writes metric is the number of write operations to disk. Write activity is generated even if your application is not active, because Cloud SQL instances write to a system table approximately every second (except for replicas).

Active connections Number of open connections to the Cloud SQL instance.
Ingress/Egress bytes (bytes/sec) The amount of network traffic coming into or leaving the instance.
Transactions/sec The number of transactions that have been committed or rolled back on the instance. These values correspond to the xact_commit and xact_rollback statistics.

Figure 1 points out the different parts of a usage chart.

Graph showing example Google Cloud SQL metric data.
Figure 1: Example instance usage data

where

  • Callout 1: The metric data displayed in the chart.

  • Callout 2: The time range for which to view the metric data.

  • Callout 3: The value of the metric at the cursor.

  • Callout 4: The data cursor. Use the cursor to find the value of a metric at a specific time.

Viewing instance usage data using Stackdriver

If you need a metric not shown in the Instance details page, or more flexibility with your data format or display options, you can use Stackdriver to get information about your Cloud SQL instance.

For a complete list of Cloud SQL metrics provided by Stackdriver, see the Cloud SQL metrics list For more information about using Stackdriver with Cloud Platform, see the Stackdriver Monitoring documentation.

Viewing instance operations log

You can view the logs for an instance in the Operations pane. The Operations pane logs every operation performed on the instance with the following information:

  • The time the operation completed, reported in your local time zone.
  • The type of operation.
  • The status of the operation.
  • A message describing the outcome the operation.

    If the operation fails, you can use the message to troubleshoot the problem.

To view an instance operations log:

  1. Go to the Cloud SQL Instances page in the Google Cloud Platform Console.

    Go to the Cloud SQL Instances page

  2. Click an instance name to open its Instance details page.
  3. Click Operations to change to the pane showing the operation log.

Note: The operations log does not include operations performed using external management tools, such as the psql client. Only user management and password change operations performed using the Google Cloud Platform Console, gcloud command-line tool, or the Cloud SQL API appear in the operations log.

Viewing log files

You can use the Logs Viewer in the Google Cloud Platform Console to view error and log files.

  1. Go to the Logs Viewer in the Google Cloud Platform Console.

    Go to the Logs Viewer

  2. Select the logs you want to see.

    You can filter based on:

    • Instance
    • Log file
    • Log level
    • Date

For more information about selecting and filtering logs, see Viewing Logs. For information about exporting logs, see Exporting Logs.

What's next

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud SQL for PostgreSQL