Skip to content

Commit b2a2ff4

Browse files
authored
Merge pull request #48605 from ousleyp/cnv-14984
CNV-14984: verbose logs with the CLI
2 parents 09921e1 + 2297d01 commit b2a2ff4

File tree

6 files changed

+117
-46
lines changed

6 files changed

+117
-46
lines changed

_topic_maps/_topic_map.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3426,7 +3426,7 @@ Topics:
34263426
Topics:
34273427
- Name: Reviewing virtualization overview
34283428
File: virt-reviewing-virtualization-overview
3429-
- Name: Viewing logs
3429+
- Name: Viewing OpenShift Virtualization logs
34303430
File: virt-logs
34313431
- Name: Viewing events
34323432
File: virt-events

modules/virt-about-vm-logs.adoc

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/logging_events_monitoring/virt-logs.adoc
4+
5+
:_content-type: REFERENCE
6+
[id="virt-common-error-messages_{context}"]
7+
= Common error messages
8+
9+
The following error messages might appear in {VirtProductName} logs:
10+
11+
`ErrImagePull` or `ImagePullBackOff`:: Indicates an incorrect deployment configuration or problems with the images that are referenced.

modules/virt-viewing-logs-cli.adoc

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/logging_events_monitoring/virt-logs.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-viewing-logs-cli_{context}"]
7+
= Viewing {VirtProductName} logs with the CLI
8+
9+
Configure log verbosity for {VirtProductName} components by editing the `HyperConverged` custom resource (CR). Then, view logs for the component pods by using the `oc` CLI tool.
10+
11+
.Procedure
12+
13+
. To set log verbosity for specific components, open the `HyperConverged` CR in your default text editor by running the following command:
14+
+
15+
[source,terminal]
16+
----
17+
$ oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
18+
----
19+
20+
. Set the log level for one or more components by editing the `spec.logVerbosityConfig` stanza. For example:
21+
+
22+
[source,yaml]
23+
----
24+
apiVersion: hco.kubevirt.io/v1beta1
25+
kind: HyperConverged
26+
metadata:
27+
name: kubevirt-hyperconverged
28+
spec:
29+
logVerbosityConfig:
30+
kubevirt:
31+
virtAPI: 5 <1>
32+
virtController: 4
33+
virtHandler: 3
34+
virtLauncher: 2
35+
virtOperator: 6
36+
----
37+
<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.
38+
39+
. Apply your changes by saving and exiting the editor.
40+
41+
. View a list of pods in the {VirtProductName} namespace by running the following command:
42+
+
43+
[source,terminal]
44+
----
45+
$ oc get pods -n openshift-cnv
46+
----
47+
+
48+
.Example output
49+
[%collapsible]
50+
====
51+
[source,terminal]
52+
----
53+
NAME READY STATUS RESTARTS AGE
54+
disks-images-provider-7gqbc 1/1 Running 0 32m
55+
disks-images-provider-vg4kx 1/1 Running 0 32m
56+
virt-api-57fcc4497b-7qfmc 1/1 Running 0 31m
57+
virt-api-57fcc4497b-tx9nc 1/1 Running 0 31m
58+
virt-controller-76c784655f-7fp6m 1/1 Running 0 30m
59+
virt-controller-76c784655f-f4pbd 1/1 Running 0 30m
60+
virt-handler-2m86x 1/1 Running 0 30m
61+
virt-handler-9qs6z 1/1 Running 0 30m
62+
virt-operator-7ccfdbf65f-q5snk 1/1 Running 0 32m
63+
virt-operator-7ccfdbf65f-vllz8 1/1 Running 0 32m
64+
----
65+
====
66+
67+
. To view logs for a component pod, run the following command:
68+
+
69+
[source,terminal]
70+
----
71+
$ oc logs -n openshift-cnv <pod_name>
72+
----
73+
+
74+
For example:
75+
+
76+
[source,terminal]
77+
----
78+
$ oc logs -n openshift-cnv virt-handler-2m86x
79+
----
80+
+
81+
[NOTE]
82+
====
83+
If a pod fails to start, you can use the `--previous` option to view logs from the last attempt.
84+
85+
To monitor log output in real time, use the `-f` option.
86+
====
87+
+
88+
.Example output
89+
[%collapsible]
90+
====
91+
[source,terminal]
92+
----
93+
{"component":"virt-handler","level":"info","msg":"set verbosity to 2","pos":"virt-handler.go:453","timestamp":"2022-04-17T08:58:37.373695Z"}
94+
{"component":"virt-handler","level":"info","msg":"set verbosity to 2","pos":"virt-handler.go:453","timestamp":"2022-04-17T08:58:37.373726Z"}
95+
{"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"}
96+
{"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"}
97+
{"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"}
98+
{"component":"virt-handler","level":"info","msg":"node-labeller is running","pos":"node_labeller.go:94","timestamp":"2022-04-17T08:58:37.391011Z"}
99+
----
100+
====

modules/virt-viewing-virtual-machine-logs-cli.adoc

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
:_content-type: ASSEMBLY
22
[id="virt-logs"]
3-
= Viewing virtual machine logs
3+
= Viewing {VirtProductName} logs
44
include::_attributes/common-attributes.adoc[]
55
:context: virt-logs
66

77
toc::[]
88

9-
include::modules/virt-about-vm-logs.adoc[leveloffset=+1]
9+
You can view logs for {VirtProductName} 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.
1010

11-
include::modules/virt-viewing-virtual-machine-logs-cli.adoc[leveloffset=+1]
11+
include::modules/virt-viewing-logs-cli.adoc[leveloffset=+1]
1212

1313
include::modules/virt-viewing-virtual-machine-logs-web.adoc[leveloffset=+1]
14+
15+
include::modules/virt-common-error-messages.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)