$ oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
You can view logs for OpenShift Virtualization components and virtual machines by using the web console or the oc
cli. You can retrieve virtual machine logs from the virt-launcher
pod. To control log verbosity, edit the HyperConverged
custom resource.
Configure log verbosity for OpenShift Virtualization components by editing the HyperConverged
custom resource (CR). Then, view logs for the component pods by using the oc
cli tool.
To set log verbosity for specific components, open the HyperConverged
CR in your default text editor by running the following command:
$ 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:
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 1–9 , 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 OpenShift Virtualization namespace by running the following command:
$ oc get pods -n openshift-cnv
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:
$ oc logs -n openshift-cnv <pod_name>
For example:
$ oc logs -n openshift-cnv virt-handler-2m86x
If a pod fails to start, you can use the To monitor log output in real time, use the |
{"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"}
Get virtual machine logs from the associated virtual machine launcher pod.
In the OpenShift Container Platform console, click Virtualization → VirtualMachines from the side menu.
Select a virtual machine to open the VirtualMachine details page.
click the Details tab.
click the virt-launcher-<name>
pod in the Pod section to open the Pod details page.
click the Logs tab to view the pod logs.