diff --git a/docs/serving/accessing-logs.md b/docs/serving/accessing-logs.md index 147ea6eab..6becff559 100644 --- a/docs/serving/accessing-logs.md +++ b/docs/serving/accessing-logs.md @@ -28,7 +28,7 @@ up the necessary components first. The Discover tab of the Kibana UI looks like this: - ![Kibana UI Discover tab](../images/kibana-discover-tab-annotated.png) + ![Kibana UI Discover tab](./images/kibana-discover-tab-annotated.png) 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 @@ -50,12 +50,32 @@ To find the logs sent to `stdout/stderr` from your application in the Kibana UI: ### Accessing request logs -To find the request logs of your application in the Kibana UI : +To access the request logs (if enabled), enter the following search in Kibana: -1. Click `Discover` on the left side bar. -1. Choose `logstash-*` index pattern on the left top. -1. Input `tag: "requestlog.logentry.istio-system"` in the top search bar then - search. +```text +_exists_:"httpRequest.requestUrl" +``` + +Request logs contain customized details about requests served by the revision. +Below is a sample request log: + +```text +@timestamp July 10th 2018, 10:09:28.000 +kubernetes.labels.serving_knative_dev/configuration helloworld-go +kubernetes.labels.serving_knative_dev/revision helloworld-go-6vf4x +kubernetes.labels.serving_knative_dev/service helloworld-go +httpRequest.protocol HTTP/1.1 +httpRequest.referer +httpRequest.remoteIp 10.32.0.2:46866 +httpRequest.requestMethod GET +httpRequest.requestSize 0 +httpRequest.requestUrl / +httpRequest.responseSize 20 +httpRequest.serverIp 10.32.1.36 +httpRequest.status 200 +httpRequest.userAgent curl/7.60.0 +traceId 0def9abf835ad90e9d824f7a492e2dcb +``` ### Accessing configuration and revision logs @@ -112,40 +132,6 @@ To access logs for a [Knative Build](../build/README.md): kubernetes.labels.build\-name: ``` -### Accessing request logs - -To access the request logs, enter the following search in Kibana: - -```text -tag: "requestlog.logentry.istio-system" -``` - -Request logs contain details about requests served by the revision. Below is a -sample request log: - -```text -@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](./accessing-traces.md) page for details. diff --git a/docs/serving/installing-logging-metrics-traces.md b/docs/serving/installing-logging-metrics-traces.md index ea5c436f1..ef08b522e 100644 --- a/docs/serving/installing-logging-metrics-traces.md +++ b/docs/serving/installing-logging-metrics-traces.md @@ -17,6 +17,17 @@ sections to do so now. ## Metrics +1. Run the following command and follow the instructions below to enable request + metrics if they are wanted: + + ``` + kubectl edit cm -n knative-serving config-observability + ``` + + Add `metrics.request-metrics-backend-destination: prometheus` to `data` + field. You can find detailed information in `data._example` field in the + `ConfigMap` you are editing. + 1. Run the following command to install Prometheus and Grafana: ```shell @@ -52,6 +63,22 @@ in Knative. ## Logs +### Enable Request Logs + +Run the following command and follow the instructions below to enable request +logs if they are wanted: + + +``` +kubectl edit cm -n knative-serving config-observability +``` + +Copy `logging.request-log-template` from `data._example` field to`data` +field in the `ConfigMap` you are editing.. You can find detailed information in +`data._example` field to customize the request log format. + +### Choose One Logging Backend + Knative offers three different setups for collecting logs. Choose one to install: @@ -59,7 +86,7 @@ install: 1. [Stackdriver](#stackdriver) 1. [Custom logging plugin](./setting-up-a-logging-plugin.md) -### Elasticsearch and Kibana +#### Elasticsearch and Kibana 1. Run the following command to install an ELK stack: @@ -116,7 +143,7 @@ install: 1. When the installation is complete and all the resources are running, you can continue to the next section and begin creating your Elasticsearch indices. -#### Create Elasticsearch Indices +##### Create Elasticsearch Indices To visualize logs with Kibana, you need to set which Elasticsearch indices to explore. @@ -140,12 +167,12 @@ explore. `Index pattern` and select `@timestamp` from `Time Filter field name` and click on `Create` button. -![Create logstash-* index](../images/kibana-landing-page-configure-index.png) +![Create logstash-* index](./images/kibana-landing-page-configure-index.png) See [Accessing Logs](./accessing-logs.md) for more information about logs in Knative. -### Stackdriver +#### Stackdriver To configure and setup monitoring: