Halaman ini menjelaskan cara menemukan dan menggunakan Cloud Logging untuk melihat dan mengajukan kueri log
untuk instance Database Migration Service Anda.
Referensi logging Database Migration Service
Lihat halaman Google Cloud logging platform untuk mengetahui definisi nama file log, resource yang dipantau, dan payload untuk
Database Migration Service.
Nama log: scroll ke bagian Cloud SQL dan pilih
file log yang sesuai untuk instance Anda. Contoh:
cloudsql.googleapis.com/postgres.log
Keparahan: pilih level log.
Rentang waktu: pilih preset atau buat rentang kustom.
gcloud
Gunakan perintah gcloud logging
untuk melihat entri log. Pada contoh di bawah, ganti PROJECT_ID.
Flag limit
adalah parameter opsional yang menunjukkan jumlah entri maksimum yang akan
ditampilkan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 UTC."],[[["\u003cp\u003eThis page explains how to access and utilize Cloud Logging for monitoring and querying logs related to your Database Migration Service instances.\u003c/p\u003e\n"],["\u003cp\u003eDatabase Migration Service leverages Cloud Logging, and the Google Cloud platform logging page provides definitions for log file names, monitored resources, and payloads.\u003c/p\u003e\n"],["\u003cp\u003eYou can view logs for your Cloud SQL instances through the Logs Explorer in the Google Cloud console by selecting your project, choosing "Cloud SQL Database" as the resource, selecting appropriate log files, specifying the log level, and defining a time range.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud logging read\u003c/code\u003e command can be used to view log entries via the command line, with an option to limit the number of entries returned.\u003c/p\u003e\n"]]],[],null,["# Logging\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n[MySQL](/database-migration/docs/mysql/logging \"View this page for the MySQL version of Database Migration Service.\") \\| PostgreSQL \\| [PostgreSQL to AlloyDB](/database-migration/docs/postgresql-to-alloydb/logging \"View this page for the PostgreSQL to AlloyDB version of Database Migration Service.\")\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nOverview\n--------\n\nThis page describes how to find and use Cloud Logging to view and query logs\nfor your Database Migration Service instance.\n\nDatabase Migration Service logging reference\n--------------------------------------------\n\nSee the [Google Cloud platform logging](/logging/docs/api/platform-logs#cloud_database_migration_service) page for definitions of log file names, monitored resources, and payloads for\nDatabase Migration Service.\n\nView Cloud SQL logs\n-------------------\n\nDatabase Migration Service uses Cloud Logging. See the [Cloud Logging documentation](/logging/docs)\nfor complete information and review the\n[Cloud SQL sample queries](/logging/docs/view/query-library-preview#sql-filters).\n\nTo view logs for your Cloud SQL instance log entries: \n\n### Console\n\n1. [Go to the Logs Explorer](https://console.cloud.google.com/logs/query)\n2. Select an existing Cloud SQL project at the top of the page.\n3. In the Query builder, add the following:\n - Resource: select **Cloud SQL Database**. In the dialog, select a Cloud SQL instance.\n - Log names: scroll to the Cloud SQL section and select appropriate log files for your instance. For example:\n - cloudsql.googleapis.com/postgres.log\n - Severity: select a log level.\n - Time range: select a preset or create a custom range.\n\n### gcloud\n\nUse the [`gcloud logging`](/sdk/gcloud/reference/logging/read)\ncommand to view log entries. In the example below, replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.\nThe [`limit`](/sdk/gcloud/reference/logging/read#--limit)\nflag is an optional parameter that indicates the maximum number of entries to\nreturn. \n\n```bash\ngcloud logging read \"projects/[PROJECT_ID]/logs/cloudsql.googleapis.com/postgres.log\" --limit=10\n```"]]