1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/virt-viewing-logs-cli.adoc
2023-03-15 17:45:08 +02:00

100 lines
3.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_content-type: PROCEDURE
[id="virt-viewing-logs-cli_{context}"]
= Viewing {VirtProductName} logs with the CLI
You can configure the verbosity level of {VirtProductName} component logs by editing the `HyperConverged` custom resource (CR). Then, you can view logs for the component pods by using the `oc` CLI tool.
.Procedure
. To set log verbosity for specific components, open the `HyperConverged` CR in your default text editor by running the following command:
+
[source,terminal]
----
$ oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
----
. Set the log level for one or more components by editing the `spec.logVerbosityConfig` stanza. For example:
+
[source,yaml]
----
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
spec:
logVerbosityConfig:
kubevirt:
virtAPI: 5 <1>
virtController: 4
virtHandler: 3
virtLauncher: 2
virtOperator: 6
----
<1> The log verbosity value must be an integer in the range `19`, where a higher number indicates a more detailed log. In this example, the `virtAPI` component logs are exposed if their priority level is `5` or higher.
. Apply your changes by saving and exiting the editor.
. View a list of pods in the {VirtProductName} namespace by running the following command:
+
[source,terminal]
----
$ oc get pods -n openshift-cnv
----
+
.Example output
[%collapsible]
====
[source,terminal]
----
NAME READY STATUS RESTARTS AGE
disks-images-provider-7gqbc 1/1 Running 0 32m
disks-images-provider-vg4kx 1/1 Running 0 32m
virt-api-57fcc4497b-7qfmc 1/1 Running 0 31m
virt-api-57fcc4497b-tx9nc 1/1 Running 0 31m
virt-controller-76c784655f-7fp6m 1/1 Running 0 30m
virt-controller-76c784655f-f4pbd 1/1 Running 0 30m
virt-handler-2m86x 1/1 Running 0 30m
virt-handler-9qs6z 1/1 Running 0 30m
virt-operator-7ccfdbf65f-q5snk 1/1 Running 0 32m
virt-operator-7ccfdbf65f-vllz8 1/1 Running 0 32m
----
====
. To view logs for a component pod, run the following command:
+
[source,terminal]
----
$ oc logs -n openshift-cnv <pod_name>
----
+
For example:
+
[source,terminal]
----
$ oc logs -n openshift-cnv virt-handler-2m86x
----
+
[NOTE]
====
If a pod fails to start, you can use the `--previous` option to view logs from the last attempt.
To monitor log output in real time, use the `-f` option.
====
+
.Example output
[%collapsible]
====
[source,terminal]
----
{"component":"virt-handler","level":"info","msg":"set verbosity to 2","pos":"virt-handler.go:453","timestamp":"2022-04-17T08:58:37.373695Z"}
{"component":"virt-handler","level":"info","msg":"set verbosity to 2","pos":"virt-handler.go:453","timestamp":"2022-04-17T08:58:37.373726Z"}
{"component":"virt-handler","level":"info","msg":"setting rate limiter to 5 QPS and 10 Burst","pos":"virt-handler.go:462","timestamp":"2022-04-17T08:58:37.373782Z"}
{"component":"virt-handler","level":"info","msg":"CPU features of a minimum baseline CPU model: map[apic:true clflush:true cmov:true cx16:true cx8:true de:true fpu:true fxsr:true lahf_lm:true lm:true mca:true mce:true mmx:true msr:true mtrr:true nx:true pae:true pat:true pge:true pni:true pse:true pse36:true sep:true sse:true sse2:true sse4.1:true ssse3:true syscall:true tsc:true]","pos":"cpu_plugin.go:96","timestamp":"2022-04-17T08:58:37.390221Z"}
{"component":"virt-handler","level":"warning","msg":"host model mode is expected to contain only one model","pos":"cpu_plugin.go:103","timestamp":"2022-04-17T08:58:37.390263Z"}
{"component":"virt-handler","level":"info","msg":"node-labeller is running","pos":"node_labeller.go:94","timestamp":"2022-04-17T08:58:37.391011Z"}
----
====