Update logs metrics (#1568)

* update docs

* change subtitile

* fix image

* fix image

* address comment
This commit is contained in:
Yanwei Guo 2019-07-02 15:27:33 -07:00 committed by Knative Prow Robot
parent 56586dbb26
commit 68a0ba0d53
2 changed files with 57 additions and 44 deletions

View File

@ -28,7 +28,7 @@ up the necessary components first.
The Discover tab of the Kibana UI looks like this: 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 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 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 ### 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. ```text
1. Choose `logstash-*` index pattern on the left top. _exists_:"httpRequest.requestUrl"
1. Input `tag: "requestlog.logentry.istio-system"` in the top search bar then ```
search.
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 ### Accessing configuration and revision logs
@ -112,40 +132,6 @@ To access logs for a [Knative Build](../build/README.md):
kubernetes.labels.build\-name: <BUILD_NAME> kubernetes.labels.build\-name: <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 ### Accessing end to end request traces
See [Accessing Traces](./accessing-traces.md) page for details. See [Accessing Traces](./accessing-traces.md) page for details.

View File

@ -17,6 +17,17 @@ sections to do so now.
## Metrics ## 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: 1. Run the following command to install Prometheus and Grafana:
```shell ```shell
@ -52,6 +63,22 @@ in Knative.
## Logs ## 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 Knative offers three different setups for collecting logs. Choose one to
install: install:
@ -59,7 +86,7 @@ install:
1. [Stackdriver](#stackdriver) 1. [Stackdriver](#stackdriver)
1. [Custom logging plugin](./setting-up-a-logging-plugin.md) 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: 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 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. 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 To visualize logs with Kibana, you need to set which Elasticsearch indices to
explore. explore.
@ -140,12 +167,12 @@ explore.
`Index pattern` and select `@timestamp` from `Time Filter field name` and `Index pattern` and select `@timestamp` from `Time Filter field name` and
click on `Create` button. 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 See [Accessing Logs](./accessing-logs.md) for more information about logs in
Knative. Knative.
### Stackdriver #### Stackdriver
To configure and setup monitoring: To configure and setup monitoring: