Accessing logs

If you have not yet installed the logging and monitoring components, go through the installation instructions to set up the necessary components first.

Kibana and Elasticsearch

  • To open the Kibana UI (the visualization tool for Elasticsearch), start a local proxy with the following command:
  kubectl proxy

This command starts a local proxy of Kibana on port 8001. For security reasons, the Kibana UI is exposed only within the cluster.

  • Navigate to the Kibana UI. It might take a couple of minutes for the proxy to work.

The Discover tab of the Kibana UI looks like this:

Kibana UI Discover tab

You can change the time frame of logs Kibana displays in the upper right corner of the screen. The main search bar is across the top of the Discover page.

  • As more logs are ingested, new fields will be discovered. To have them indexed, go to “Management” > “Index Patterns” > Refresh button (on top right) > “Refresh fields”.

Accessing stdout/stderr logs

To find the logs sent to stdout/stderr from your application in the Kibana UI:

  1. Click Discover on the left side bar.
  2. Choose logstash-* index pattern on the left top.
  3. Input tag: kubernetes* in the top search bar then search.

Accessing request logs

To find the request logs of your application in the Kibana UI :

  1. Click Discover on the left side bar.
  2. Choose logstash-* index pattern on the left top.
  3. Input tag: "requestlog.logentry.istio-system" in the top search bar then search.

Accessing configuration and revision logs

To access the logs for a configuration:

  • Find the configuration’s name with the following command:
kubectl get configurations
  • Replace <CONFIGURATION_NAME> and enter the following search query in Kibana:
kubernetes.labels.serving_knative_dev\/configuration: <CONFIGURATION_NAME>

To access logs for a revision:

  • Find the revision’s name with the following command:
kubectl get revisions
  • Replace <REVISION_NAME> and enter the following search query in Kibana:
kubernetes.labels.serving_knative_dev\/revision: <REVISION_NAME>

Accessing build logs

To access logs for a Knative Build:

  • Find the build’s name in the specified in the .yaml file:
  apiVersion: build.knative.dev/v1alpha1
  kind: Build
  metadata:
    name: <BUILD_NAME>

Or find build names with the following command:

  kubectl get builds
  • Replace <BUILD_NAME> and enter the following search query in Kibana:
kubernetes.labels.build\-name: <BUILD_NAME>

Accessing request logs

To access the request logs, enter the following search in Kibana:

tag: "requestlog.logentry.istio-system"

Request logs contain details about requests served by the revision. Below is a sample request log:

@timestamp                   July 10th 2018, 10:09:28.000
destinationConfiguration     configuration-example
destinationNamespace         default
destinationRevision          configuration-example-00001
destinationService           configuration-example-00001-service.default.svc.cluster.local
latency                      1.232902ms
method                       GET
protocol                     http
referer                      unknown
requestHost                  route-example.default.example.com
requestSize                  0
responseCode                 200
responseSize                 36
severity                     Info
sourceNamespace              istio-system
sourceService                unknown
tag                          requestlog.logentry.istio-system
traceId                      986d6faa02d49533
url                          /
userAgent                    curl/7.60.0

Accessing end to end request traces

See Accessing Traces page for details.

Stackdriver

Go to the GCP Console logging page for your GCP project, which stores your logs via Stackdriver.


Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.