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:

    1. 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 access the request logs (if enabled), enter the following search in Kibana:

  1. _exists_:"httpRequest.requestUrl"

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

  1. @timestamp July 10th 2018, 10:09:28.000
  2. kubernetes.labels.serving_knative_dev/configuration helloworld-go
  3. kubernetes.labels.serving_knative_dev/revision helloworld-go-6vf4x
  4. kubernetes.labels.serving_knative_dev/service helloworld-go
  5. httpRequest.protocol HTTP/1.1
  6. httpRequest.referer
  7. httpRequest.remoteIp 10.32.0.2:46866
  8. httpRequest.requestMethod GET
  9. httpRequest.requestSize 0
  10. httpRequest.requestUrl /
  11. httpRequest.responseSize 20
  12. httpRequest.serverIp 10.32.1.36
  13. httpRequest.status 200
  14. httpRequest.userAgent curl/7.60.0
  15. traceId 0def9abf835ad90e9d824f7a492e2dcb

Accessing configuration and revision logs

To access the logs for a configuration:

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

To access logs for a revision:

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

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.