You are viewing documentation for Anthos Service Mesh 1.10. View the latest documentation or select another available version:

Accessing logs in Cloud Logging

The Anthos Service Mesh pages provide links to three different types of logs in Cloud Logging: appllication logs, error logs, and traffic logs.

Accessing application logs

To view application logs for a Service during a specified time span, follow these steps:

  1. Go to the Anthos Service Mesh page in the Google Cloud Console.

    Go to the Anthos Service Mesh page

  2. Under Services, select the name of the Service you want to inspect.

  3. Go to the Metrics page.

  4. Specify a time span from the Time Span dropdown menu or set a custom span with the timeline.

  5. Click View application logs.

The application logs are the logs generated by your own application code and are attached to the corresponding monitored resource (k8s_container or gce_instance) your application is using.

Accessing error logs

To view error logs for a Service during a specified time span, follow these steps:

  1. In Google Cloud Console, go to the Anthos Service Mesh page.

    Go to the Anthos Service Mesh page

  2. Under Services, select the name of the Service you want to inspect.

  3. Go to the Diagnostics page.

  4. Specify a time span from the Time Span dropdown menu or set a custom span with the timeline.

  5. In the upper-right corner of the window, click Open in logging

Accessing traffic logs

To view traffic logs, or acccess logs in Istio, for a Service during a specified time span follow these steps:

  1. In Google Cloud Console, go to the Anthos Service Mesh page.

    Go to the Anthos Service Mesh page

  2. Under Services, select the name of the Service you want to inspect.

  3. Go to the Metrics page.

  4. Specify a time span from the Time Span dropdown menu or set a custom span with the timeline.

  5. Under Select a filter option, click View traffic logs.

The traffic log is named as server-accesslog-stackdriver and is attached to the corresponding monitored resource (k8s_container or gce_instance) your service is using. The traffic log contains the following information:

  • HTTP request properties, such as ID, URL, size, latency, and common headers.

  • Source and destination workload information, such as name, namespace, identity, and common labels.

  • If tracing is enabled, trace information, such as sampling, trace ID, and span ID.

An example log entry looks like the following:

{
  insertId: "1awb4hug5pos2qi"
  httpRequest: {
    requestMethod: "GET"
    requestUrl: "YOUR-INGRESS/productpage"
    requestSize: "952"
    status: 200
    responseSize: "5875"
    remoteIp: "10.8.0.44:0"
    serverIp: "10.56.4.25:9080"
    latency: "1.587232023s"
    protocol: "http"
  }
  resource: {
    type: "k8s_container"
    labels: {
      location: "us-central1-a"
      project_id: "YOUR-PROJECT"
      pod_name: "productpage-v1-76589d9fdc-ptnt9"
      cluster_name: "YOUR-CLUSTER-NAME"
      container_name: "productpage"
      namespace_name: "default"
    }
  }
  timestamp: "2020-04-28T19:55:21.056759Z"
  severity: "INFO"
  labels: {
    destination_principal: "spiffe://cluster.local/ns/default/sa/bookinfo-productpage"
    response_flag: "-"
    destination_service_host: "productpage.default.svc.cluster.local"
    source_app: "istio-ingressgateway"
    service_authentication_policy: "MUTUAL_TLS"
    source_name: "istio-ingressgateway-5ff85d8dd8-mwplb"
    mesh_uid: "YOUR-MESH-UID"
    request_id: "021ce752-9001-4ac6-b6d6-3b15f5d3632"
    destination_namespace: "default"
    source_principal:  "spiffe://cluster.local/ns/istio-system/sa/istio-ingressgateway-service-account"
    destination_workload: "productpage-v1"
    destination_version: "v1"
    source_namespace: "istio-system"
    source_workload: "istio-ingressgateway"
    destination_name: "productpage-v1-76589d9fdc-ptnt9"
    destination_app: "productpage"
  }
  trace: "projects/YOUR-PROJECT/traces/d4197f59b7a43e3aeff3571bac99d536"
  receiveTimestamp: "2020-04-29T03:07:14.362416217Z"
  spanId: "43226343ca2bb2b1"
  traceSampled: true
  logName: "projects/YOUR-PROJECT/logs/server-accesslog-stackdriver"
  receiveTimestamp: "2020-04-28T19:55:32.185229100Z"
}

What's next