|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * logging/viewing/cluster-logging-visualizer.adoc |
| 4 | + |
| 5 | +[id="cluster-logging-visualizer-kibana_{context}"] |
| 6 | += Viewing cluster logs in Kibana |
| 7 | + |
| 8 | +You view cluster logs in the Kibana web console. The methods for viewing and visualizing your data in Kibana that are beyond the scope of this documentation. For more information, refer to the link:https://www.elastic.co/guide/en/kibana/6.8/tutorial-sample-discover.html[Kibana documentation]. |
| 9 | + |
| 10 | +.Prerequisites |
| 11 | + |
| 12 | +* Cluster logging and Elasticsearch must be installed. |
| 13 | + |
| 14 | +* Kibana index patterns must exist. |
| 15 | + |
| 16 | +* A user must have the `cluster-admin` role, the `cluster-reader` role, or both roles to view the *infra* and *audit* indices in Kibana. The default `kubeadmin` user has proper permissions to view these indices. |
| 17 | ++ |
| 18 | +If you can view the pods and logs in the `default`, `kube-` and `openshift-` projects, you should be able to access the these indices. You can use the following command to check if the current user has appropriate permissions: |
| 19 | ++ |
| 20 | +[source,terminal] |
| 21 | +---- |
| 22 | +$ oc auth can-i get pods/log -n <project> |
| 23 | +---- |
| 24 | ++ |
| 25 | +.Example output |
| 26 | +[source,terminal] |
| 27 | +---- |
| 28 | +yes |
| 29 | +---- |
| 30 | ++ |
| 31 | +[NOTE] |
| 32 | +==== |
| 33 | +The audit logs are not stored in the internal {product-title} Elasticsearch instance by default. To view the audit logs in Kibana, you must use the Log Forwarding API to configure a pipeline that uses the `default` output for audit logs. |
| 34 | +==== |
| 35 | + |
| 36 | +.Procedure |
| 37 | + |
| 38 | +To view logs in Kibana: |
| 39 | + |
| 40 | +. In the {product-title} console, click the Application Launcher {launch} and select *Logging*. |
| 41 | + |
| 42 | +. Log in using the same credentials you use to log in to the {product-title} console. |
| 43 | ++ |
| 44 | +The Kibana interface launches. |
| 45 | + |
| 46 | +. In Kibana, click *Discover*. |
| 47 | + |
| 48 | +. Select the index pattern you created from the drop-down menu in the top-left corner: *app*, *audit*, or *infra*. |
| 49 | ++ |
| 50 | +The log data displays as time-stamped documents. |
| 51 | + |
| 52 | +. Expand one of the time-stamped documents. |
| 53 | + |
| 54 | +. Click the *JSON* tab to display the log entry for that document. |
| 55 | ++ |
| 56 | +.Sample infrastructure log entry in Kibana |
| 57 | +[source,terminal] |
| 58 | +---- |
| 59 | +{ |
| 60 | + "_index": "infra-000001", |
| 61 | + "_type": "_doc", |
| 62 | + "_id": "YmJmYTBlNDkZTRmLTliMGQtMjE3NmFiOGUyOWM3", |
| 63 | + "_version": 1, |
| 64 | + "_score": null, |
| 65 | + "_source": { |
| 66 | + "docker": { |
| 67 | + "container_id": "f85fa55bbef7bb783f041066be1e7c267a6b88c4603dfce213e32c1" |
| 68 | + }, |
| 69 | + "kubernetes": { |
| 70 | + "container_name": "registry-server", |
| 71 | + "namespace_name": "openshift-marketplace", |
| 72 | + "pod_name": "redhat-marketplace-n64gc", |
| 73 | + "container_image": "registry.redhat.io/redhat/redhat-marketplace-index:v4.6", |
| 74 | + "container_image_id": "registry.redhat.io/redhat/redhat-marketplace-index@sha256:65fc0c45aabb95809e376feb065771ecda9e5e59cc8b3024c4545c168f", |
| 75 | + "pod_id": "8f594ea2-c866-4b5c-a1c8-a50756704b2a", |
| 76 | + "host": "ip-10-0-182-28.us-east-2.compute.internal", |
| 77 | + "master_url": "https://kubernetes.default.svc", |
| 78 | + "namespace_id": "3abab127-7669-4eb3-b9ef-44c04ad68d38", |
| 79 | + "namespace_labels": { |
| 80 | + "openshift_io/cluster-monitoring": "true" |
| 81 | + }, |
| 82 | + "flat_labels": [ |
| 83 | + "catalogsource_operators_coreos_com/update=redhat-marketplace" |
| 84 | + ] |
| 85 | + }, |
| 86 | + "message": "time=\"2020-09-23T20:47:03Z\" level=info msg=\"serving registry\" database=/database/index.db port=50051", |
| 87 | + "level": "unknown", |
| 88 | + "hostname": "ip-10-0-182-28.internal", |
| 89 | + "pipeline_metadata": { |
| 90 | + "collector": { |
| 91 | + "ipaddr4": "10.0.182.28", |
| 92 | + "inputname": "fluent-plugin-systemd", |
| 93 | + "name": "fluentd", |
| 94 | + "received_at": "2020-09-23T20:47:15.007583+00:00", |
| 95 | + "version": "1.7.4 1.6.0" |
| 96 | + } |
| 97 | + }, |
| 98 | + "@timestamp": "2020-09-23T20:47:03.422465+00:00", |
| 99 | + "viaq_msg_id": "YmJmYTBlNDktMDMGQtMjE3NmFiOGUyOWM3", |
| 100 | + "openshift": { |
| 101 | + "labels": { |
| 102 | + "logging": "infra" |
| 103 | + } |
| 104 | + } |
| 105 | + }, |
| 106 | + "fields": { |
| 107 | + "@timestamp": [ |
| 108 | + "2020-09-23T20:47:03.422Z" |
| 109 | + ], |
| 110 | + "pipeline_metadata.collector.received_at": [ |
| 111 | + "2020-09-23T20:47:15.007Z" |
| 112 | + ] |
| 113 | + }, |
| 114 | + "sort": [ |
| 115 | + 1600894023422 |
| 116 | + ] |
| 117 | +} |
| 118 | +---- |
| 119 | + |
0 commit comments