참고: 작업 로그에는 SQL Server 명령줄 도구와 같은 외부 관리 도구를 사용하여 수행한 작업이 포함되지 않습니다.
Google Cloud 콘솔, gcloud CLI 또는 Cloud SQL Admin API를 사용하여 수행한 사용자 관리 및 비밀번호 변경 작업만 작업 로그에 표시됩니다.
애플리케이션 로그 보기
Cloud SQL에 연결되는 애플리케이션은 로그를 다른 위치에 저장합니다.
App Engine(가변형 환경)
컴퓨팅 > App Engine > 서비스 아래:
서비스 목록에서 서비스를 찾습니다.
도구 드롭다운을 클릭합니다.
로그 선택
Google Cloud 콘솔의 작업 > 로깅 > 로그 탐색기 섹션에서 다음 쿼리를 사용합니다.
데이터 액세스 로그는 작업이 사용자가 만든 데이터를 생성 또는 수정하거나 읽는 인증된 사용자 주도 API 호출인 경우 또는 작업이 리소스의 구성 파일 또는 메타데이터에 액세스하는 경우에만 작성됩니다.
로그에 작업 정보가 없음
작업에 대한 자세한 정보를 찾으려 합니다.
예를 들어 사용자가 삭제되었는데 누가 삭제했는지 알 수 없습니다.
로그는 작업이 시작되었음을 표시하지만 그 이상의 정보를 제공하지 않습니다. 이와 같은 자세한 개인 식별 정보(PII)를 로깅하려면 감사 로깅을 사용 설정해야 합니다.
일부 로그는 SQL Server용 Cloud SQL 인스턴스의 error.log 로그에서 필터링됩니다.
필터링된 로그는 타임스탬프가 없는 AD 로그를 포함하며 다음을 포함합니다. Login failed for user 'x'. Reason: Token-based server access
validation failed with an infrastructure error. Login lacks connect endpoint
permission. [CLIENT: 127.0.0.1] 이러한 로그는 잠재적으로 혼란을 야기할 수 있으므로 필터링됩니다.
로그 파일을 읽기 어려움
로그를 json 또는 텍스트로 보는 것이 좋습니다.gcloud logging read 명령어를 Linux 후처리 명령어와 함께 사용하여 로그를 다운로드할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[],[],null,["# View instance logs\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/logging \"View this page for the MySQL database engine\") \\| [PostgreSQL](/sql/docs/postgres/logging \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page describes how to find and use Cloud Logging to view and query logs\nfor your Cloud SQL instance.\n\nCloud SQL 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\nView logs\n---------\n\nTo view logs for your Cloud SQL instance log entries: \n\n### Console\n\n1. In the Google Cloud console, go to the **Cloud Logging** page.\n\n [Go to Cloud Logging](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/sqlagent.out\n - cloudsql.googleapis.com/sqlserver.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 \"resource.type=cloudsql_database\" \\\n--project=PROJECT-ID \\\n--limit=10 \\\n--format=json\n```\n\nView instance operations log\n----------------------------\n\nYou can view the logs for an instance in the **Operations** pane.\nThe **Operations** pane logs every operation performed on the\ninstance with the following information:\n\n- The time the operation completed, reported in your local time zone.\n- The type of operation.\n- The status of the operation.\n- A message describing the outcome the operation.\n\nIf the operation fails, you can use the message to troubleshoot the problem.\n\n**To view an instance operations log:**\n\n1. In the Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. To open the **Overview** page of an instance, click the instance name.\n3. Click **Operations** to change to the pane showing the operation log.\n\n**Note:** The operations log does not include operations performed using external management tools, such as SQL Server command-line tools. Only user management and password change operations performed using the Google Cloud console, [gcloud CLI](/sdk/gcloud), or the Cloud SQL Admin API appear in the operations log.\n\nView application logs\n---------------------\n\nApplications that connect to Cloud SQL store their logs in different\nlocations.\n\n### App Engine (flexible environment)\n\nIn **Compute \\\u003e App Engine \\\u003e Services**:\n\n- In the list of services, find your service.\n- Click on the **Tools** dropdown.\n- Select **logs**\n\nIn the **Operations \\\u003e Logging \\\u003e Logs explorer** section of Google Cloud console,\nuse the following query: \n\n resource.type=\"gae_app\"\n resource.labels.module_id=\"default\"\n\n### Cloud Run\n\nView the logs in the Cloud Run **Logs Explorer** section of the\nGoogle Cloud console. Note that Cloud Run reports only error messages from\nthe Cloud SQL Auth Proxy. Use a query like the following: \n\n resource.type=\"cloud_run_revision\"\n resource.labels.service_name=\"$SERVICE_NAME\"\n resource.labels.revision_name=\"$REVISION_NAME\"\n\n### Cloud SQL Auth Proxy\n\nIn **Operations \\\u003e Logging \\\u003e Logs explorer**, use the following query: \n\n log_id(\"appengine.googleapis.com/cloud-sql-proxy\")\n\nView audit logs\n---------------\n\nYou can view the following types of audit logs for your Cloud SQL instances:\n\n- Admin Activity: include administrator operations that write metadata or configuration information. You can't deactivate these logs.\n- Data Access: include administrator operations that read metadata or configuration information. These logs also include operations that read or write user-provided data. To receive Data Access audit logs, you must [enable them explicitly](/logging/docs/audit/configure-data-access#config-console-enable).\n- System Event: identify automated actions in Google Cloud that modify the configuration of resources. You can't deactivate these logs.\n\nFor more information about viewing Admin Activity, Data Access, and System Event audit logs, see [View logs](/sql/docs/sqlserver/audit-logging#viewing_logs).\n\nPricing\n-------\n\nFor more information about Cloud Logging pricing, see\n[Cloud Logging pricing summary](/stackdriver/pricing#logs-costs).\n\nTroubleshoot\n------------"]]