서비스 메시를 사용하면 서비스를 오가는 트래픽을 관찰할 수 있으므로 서비스 자체의 코드 변경 없이 더욱 풍부한 모니터링과 디버깅이 가능합니다. 로그 항목은 성공적인 연결 및 연결 해제에 대한 레코드, 잘못 구성된 클라이언트의 오류 보고서, API 리소스 충돌에 대한 알림을 포함해 서비스 메시 문제 해결에 중요한 정보를 제공할 수 있습니다.
사용 사례
다음은 제어 영역 로깅 및 모니터링을 위한 세 가지 사용 사례입니다.
Cloud Service Mesh 컨트롤 플레인을 위한 Cloud Logging: Logging의 모든 기본 제공 기능을 사용해서 모든 Cloud Service Mesh 로깅 데이터 및 이벤트에 대해 저장, 검색, 분석, 알림 설정을 안전하게 수행할 수 있습니다. 구성 문제가 감지될 때는 물론 Envoy 또는 gRPC 클라이언트가 연결 또는 연결 해제될 때 Cloud Service Mesh가 Logging에 로그를 내보냅니다.
Cloud Service Mesh 컨트롤 플레인을 위한 Cloud Monitoring: Cloud Service Mesh가 Cloud Service Mesh 컨트롤 플레인에 연결된 클라이언트 수를 나타내는 주요 측정항목을 Monitoring에 내보냅니다.
Monitoring에서 대시보드를 설정하고 이 측정항목을 실시간으로 시각화하여 클라이언트가 연결 및 연결 해제될 때 메시 상태를 모니터링할 수 있습니다. 또한 메시에 대해 SLO를 설정할 수 있습니다.
즉각적인 문제 해결: Cloud Service Mesh가 기본적으로 Logging 및 Monitoring에 원격 분석을 내보냅니다. 로깅 및 모니터링 구성을 위한 추가 설정이 필요하지 않으므로, 처음 메시를 설정할 때를 포함하여 언제든지 문제를 해결할 수 있습니다.
로그 보기
Cloud Service Mesh 로그를 보려면 로그 탐색기를 사용합니다. 다음 섹션에서는 Cloud Service Mesh 로그를 보는 쿼리 예시를 설명하지만 이전 링크를 사용하여 자체 쿼리를 만들 수 있습니다.
Cloud Service Mesh 리소스가 올바르게 구성되었지만 xDS 클라이언트 노드 메타데이터에 TRAFFICDIRECTOR_INTERCEPTION_PORT 변수가 설정되지 않아서 이 구성을 클라이언트에 추가할 수 없는 경우 이 유형의 로그 메시지가 생성됩니다.
'가로채기 리스너가 지정된 포트 15001에 빌드되었지만 라우팅 구성이 존재하지 않습니다.'
xDS 클라이언트 노드 메타데이터에 TRAFFICDIRECTOR_INTERCEPTION_PORT 변수가 설정되어 있지만 Cloud Service Mesh에서 완전한 xDS 응답을 생성하기 위해 필요한 리소스가 구성되지 않은 경우 이 유형의 로그 메시지가 생성됩니다.
'Cloud Service Mesh에서 ADS 응답을 보내지 못했습니다. 노드의 마지막 검색 요청에 잘못된 버전 및/또는 nonce가 있습니다.'
이 유형의 로그 메시지는 xDS 클라이언트의 손상된 통신으로 인해 Cloud Service Mesh에서 xDS 응답을 올바르게 처리할 수 없을 때 생성됩니다. 이 메시지는 클라이언트의 구현 오류를 나타냅니다. 클라이언트의 로그를 확인하는 것이 좋습니다.
'클라이언트가 리전 간 트래픽을 백엔드 서비스 backend_service_id로 전송합니다. 소스 리전: source_region
대상 리전: destination_region1, destination_region2'
이 유형의 로그 메시지는 클라이언트가 소스 리전에서 하나 이상의 대상 리전으로 리전 간 트래픽을 전송했음을 Cloud Service Mesh에 보고할 때 생성됩니다.
측정항목 보기
Cloud Service Mesh는 xDS API 연결 스트림, 요청 수, 영역별 요청 수라는 두 가지 측정항목을 Cloud Monitoring으로 내보냅니다. xDS API 연결 스트림은 컨트롤 플레인에 연결된 클라이언트 수를 나타내고 요청 수는 소스 리전, 대상 리전, 요청 상태별로 그룹화된 백엔드 서비스로 전송된 요청 수를 나타냅니다. 영역별 요청 수는 백엔드 서비스로 전송되는 요청 수를 소스 영역, 대상 영역, 요청 상태별로 그룹화한 것입니다. 이러한 측정항목을 보려면 측정항목 탐색기를 사용합니다.
다음 단계에서는 로그 기반 측정항목을 설정해야 합니다. 로그 기반 측정항목 설정에 대한 자세한 내용은 개요를 참조하세요.
사용자가 지정한 메시지가 포함된 로그에 표시되면 알림을 받도록 알림을 구성할 수 있습니다. 이러한 알림을 통해 예상치 못한 상황이 발생할 경우 운영자에게 이를 알릴 수 있습니다. 예를 들어 Cloud Service Mesh 구성 변경으로 인해 API 리소스가 충돌하면 오류 메시지에 대한 알림이 전송될 수 있습니다. 로그 기반 측정항목에 알림을 설정하려면 차트 및 알림 구성을 참조하세요.
[[["이해하기 쉬움","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-04-23(UTC)"],[],[],null,["# Control plane logging and monitoring\n====================================\n\n| **Note:** This guide only supports Cloud Service Mesh with Google Cloud APIs and does not support Istio APIs. For more information see, [Cloud Service Mesh overview](/service-mesh/v1.24/docs/overview).\n\nThis document demonstrates how to use [Cloud Logging](/logging/docs) and\n[Cloud Monitoring](/monitoring/docs) to view logs and metrics for the\nCloud Service Mesh control plane.\n\nUsing a service mesh gives you the ability to observe traffic to and from\nservices, which allows for richer monitoring and debugging without code changes\nin the service itself. Log entries can provide important information for\ntroubleshooting your service mesh, including records of successful connections\nand disconnections, error reports for misconfigured clients, and alerts\nabout API resource conflicts.\n\nUse cases\n---------\n\nThe following are three use cases for control plane logging and monitoring:\n\n- **Cloud Logging for Cloud Service Mesh control plane**: You can securely store, search, analyze, and set alerts on all of your Cloud Service Mesh logging data and events using all the built-in features of Logging. Cloud Service Mesh exports logs to Logging when an Envoy or gRPC client connects or disconnects, as well as when it detects configuration issues.\n- **Cloud Monitoring for Cloud Service Mesh control plane**: Cloud Service Mesh exports a key metric indicating the number of clients connected to the Cloud Service Mesh control plane to Monitoring. You can set up a dashboard in Monitoring and visualize this metric in real time to monitor the health of the mesh as clients connect and disconnect. This also lets you set up an SLO for your mesh.\n- **Troubleshoot issues immediately**: Cloud Service Mesh exports telemetry to Logging and Monitoring by default. No additional setup is necessary to configure logging and monitoring, enabling you to troubleshoot issues at any time, including when you are setting up the mesh for the first time.\n\nView logs\n---------\n\nTo view Cloud Service Mesh logs, use the\n[Logs Explorer](/logging/docs/view/logs-explorer-interface). The following\nsection presents an example query to view Cloud Service Mesh logs, but you can\nuse the previous link to create your own query.\n\n1. In the Google Cloud console, go to the **Logs Explorer** page.\n\n [Go to the Logs Explorer](https://console.cloud.google.com/logs/query)\n2. In the **Resource** list,\n - If you use the service routing APIs, select `Gateway Scope` or `Mesh`.\n - If you use the older APIs, select `GCE Network`.\n3. In the **Log name** list, select `trafficdirector.googleapis.com/events`.\n4. Click **Run query**.\n\n### Cloud Service Mesh log entry fields\n\n### Example log entries\n\nView metrics\n------------\n\nCloud Service Mesh exports three metrics to Cloud Monitoring:\n**xDS API Connected Streams** , **Request count** , and **Request count by zone** .\n**xDS API Connected Streams** indicates the number of clients that are\nconnected to your control plane; **Request count** indicates the number of\nrequests sent to a backend service, grouped by source region, destination\nregion, and request status. **Request count by zone** indicates the number\nof requests sent to a backend service, grouped by source zone, destination\nzone, and request status. To view these metrics, use the\n[Metrics Explorer](/monitoring/charts/metrics-explorer).\n\nTo view Cloud Service Mesh metrics, do the following:\n\n1. In the Google Cloud console, go to the **Metrics Explorer** page.\n\n [Go to the Metrics Explorer](https://console.cloud.google.com/monitoring/metrics-explorer)\n2. In the **Resource type** list, select a resource.\n - If you use the service routing APIs, select `Gateway Scope` or `Mesh`.\n - If you use the older APIs, select `Network`.\n3. In the **Metric** list, select `connected_clients`.\n4. Return to the **Resource type** list, and then select `Compute Engine Backend\n Service`.\n5. In the **Metric** list, select either `Request count` or `Request count by zone`.\n\nAlternatively, you can use a query to view the cross-region request count:\n\n1. Select **MQL**.\n2. In the field, enter the following example query: \n\n ```\n fetch gce_backend_service\n | metric 'trafficdirector.googleapis.com/xds/server/request_count'\n | filter ( ne(metric.source_region, metric.destination_region))\n | align rate(1m)\n | every 1m\n | group_by [metric.source_region, metric.destination_region, resource.backend_service_id],\n [value_request_count_aggregate: aggregate(value.request_count)]\n ```\n3. Click **Run query**.\n\nSet up logs-based metrics and alerts\n------------------------------------\n\nThe following steps require that you set up logs-based metrics. For more\ninformation about setting up logs-based metrics, see the\n[overview](/logging/docs/logs-based-metrics#viewing).\n\nYou can configure alerts to notify you when user-specified messages appear in\nyour included logs. These alerts can notify the operator when something\nunexpected occurs. For example, if a change in Cloud Service Mesh configuration\nresults in API resource conflicts, you can receive an alert on the error\nmessage. To set up alerts on your log-based metrics, see\n[Configure charts and alerts](/logging/docs/logs-based-metrics/charts-and-alerts#alert-on-lbm)."]]