Questa pagina descrive come trovare e utilizzare Cloud Logging per visualizzare e eseguire query sui log per la tua istanza Database Migration Service.
Riferimento alla registrazione di Database Migration Service
Consulta la pagina relativa al Google Cloud logging della piattaforma per le definizioni dei nomi dei file di log, delle risorse monitorate e dei payload per Database Migration Service.
Seleziona un progetto Cloud SQL esistente nella parte superiore della pagina.
In Query Builder, aggiungi quanto segue:
Risorsa: seleziona Database Cloud SQL. Nella finestra di dialogo, seleziona un'istanza Cloud SQL.
Nomi dei log: scorri fino alla sezione Cloud SQL e seleziona
i file di log appropriati per la tua istanza. Ad esempio:
cloudsql.googlapis.com/mysql-general.log
cloudsql.googleapis.com/mysql.err
Gravità: seleziona un livello di log.
Intervallo di tempo: seleziona un'impostazione predefinita o crea un intervallo personalizzato.
gcloud
Utilizza il comando gcloud logging per visualizzare le voci di log. Nell'esempio seguente, sostituisci PROJECT_ID.
Il flag limit
è un parametro facoltativo che indica il numero massimo di voci da
restituire.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-05 UTC."],[[["\u003cp\u003eThis page explains how to access and utilize Cloud Logging to monitor logs for your Database Migration Service instances.\u003c/p\u003e\n"],["\u003cp\u003eDatabase Migration Service leverages Cloud Logging, and you can find definitions of log files, resources, and payloads on the Google Cloud platform logging page.\u003c/p\u003e\n"],["\u003cp\u003eTo view Cloud SQL instance logs, navigate to the Logs Explorer in the Google Cloud console, select your project, resource, and relevant log names.\u003c/p\u003e\n"],["\u003cp\u003eYou can also view log entries using the \u003ccode\u003egcloud logging read\u003c/code\u003e command, specifying the project ID and log file name, with an optional limit parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud SQL sample queries on the Cloud Logging page can also be used.\u003c/p\u003e\n"]]],[],null,["# Logging\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/database-migration/docs/postgres/logging \"View this page for the PostgreSQL version of Database Migration Service.\") \\| [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.googlapis.com/mysql-general.log\n - cloudsql.googleapis.com/mysql.err\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/mysql-general.log\" --limit=10\n```"]]