If you have not yet installed the logging and monitoring components, go through the installation instructions to set up the necessary components first.
-
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:
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".
To find the logs sent to stdout/stderr
from your application in the Kibana UI:
- Click
Discover
on the left side bar. - Choose
logstash-*
index pattern on the left top. - Input
tag: kubernetes*
in the top search bar then search.
To find the request logs of your application in the Kibana UI :
- Click
Discover
on the left side bar. - Choose
logstash-*
index pattern on the left top. - Input
tag: "requestlog.logentry.istio-system"
in the top search bar then search.
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>
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>
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
See Accessing Traces page for details.
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.