1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

CNV-30908: guest log access

This commit is contained in:
Pan Ousley
2024-02-19 18:23:21 -05:00
committed by openshift-cherrypick-robot
parent 73b2426225
commit f7009c801b
9 changed files with 205 additions and 24 deletions

View File

@@ -0,0 +1,32 @@
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-enable-guest-log-default-cli_{context}"]
= Enabling default access to VM guest system logs with the CLI
You can enable default access to VM guest system logs by editing the `HyperConverged` custom resource (CR).
.Procedure
. Open the `HyperConverged` CR in your default editor by running the following command:
+
[source,terminal,subs="attributes+"]
----
$ oc edit hyperconverged kubevirt-hyperconverged -n {CNVNamespace}
----
. Update the `disableSerialConsoleLog` value. For example:
+
[source,yaml]
----
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
spec:
virtualMachineOptions:
disableSerialConsoleLog: true <1>
#...
----
<1> Set the value of `disableSerialConsoleLog` to `false` if you want serial console access to be enabled on VMs by default.

View File

@@ -0,0 +1,19 @@
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-enable-guest-log-default-web_{context}"]
= Enabling default access to VM guest system logs with the web console
You can enable default access to VM guest system logs by using the web console.
.Procedure
. From the side menu, click *Virtualization* -> *Overview*.
. Click the *Settings* tab.
. Click *Cluster* -> *Guest management*.
. Set *Enable guest system log access* to on.

View File

@@ -0,0 +1,50 @@
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-set-guest-log-single-vm-cli_{context}"]
= Setting guest system log access for a single VM with the CLI
You can configure access to VM guest system logs for a single VM by editing the `VirtualMachine` CR. This setting takes precedence over the cluster-wide default configuration.
.Procedure
. Edit the virtual machine manifest by running the following command:
+
[source,terminal]
----
$ oc edit vm <vm_name>
----
. Update the value of the `logSerialConsole` field. For example:
+
[source,yaml]
----
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: example-vm
spec:
template:
spec:
domain:
devices:
logSerialConsole: true <1>
#...
----
<1> To enable access to the guest's serial console log, set the `logSerialConsole` value to `true`.
. Apply the new configuration to the VM by running the following command:
+
[source,terminal]
----
$ oc apply vm <vm_name>
----
. Optional: If you edited a running VM, restart the VM to apply the new configuration. For example:
+
[source,terminal]
----
$ virtctl restart <vm_name> -n <namespace>
----

View File

@@ -0,0 +1,19 @@
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-set-guest-log-single-vm-web_{context}"]
= Setting guest system log access for a single VM with the web console
You can configure access to VM guest system logs for a single VM by using the web console. This setting takes precedence over the cluster-wide default configuration.
.Procedure
. Click *Virtualization* -> *VirtualMachines* from the side menu.
. Select a virtual machine to open the *VirtualMachine details* page.
. Click the *Configuration* tab.
. Set *Guest system log access* to on or off.

View File

@@ -0,0 +1,22 @@
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-view-guest-system-logs-cli_{context}"]
= Viewing guest system logs with the CLI
You can view the serial console logs of a VM guest by running the `oc logs` command.
.Prerequisites
* Guest system log access is enabled.
.Procedure
* View the logs by running the following command, substituting your own values for `<namespace>` and `<vm_name>`:
+
[source,terminal]
----
$ oc logs -n <namespace> -l kubevirt.io/domain=<vm_name> --tail=-1 -c guest-console-log
----

View File

@@ -0,0 +1,23 @@
// Module included in the following assemblies:
//
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-view-guest-system-logs-web_{context}"]
= Viewing guest system logs with the web console
You can view the serial console logs of a virtual machine (VM) guest by using the web console.
.Prerequisites
* Guest system log access is enabled.
.Procedure
. Click *Virtualization* -> *VirtualMachines* from the side menu.
. Select a virtual machine to open the *VirtualMachine details* page.
. Click the *Diagnostics* tab.
. Click *Guest system logs* to load the serial console.

View File

@@ -3,10 +3,10 @@
// * virt/support/virt-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-viewing-virtual-machine-logs-web_{context}"]
= Viewing virtual machine logs with the web console
[id="virt-viewing-virt-launcher-pod-logs-web_{context}"]
= Viewing virt-launcher pod logs with the web console
You can view virtual machine logs with the {product-title} web console.
You can view the `virt-launcher` pod logs for a virtual machine by using the {product-title} web console.
.Procedure
@@ -14,6 +14,6 @@ You can view virtual machine logs with the {product-title} web console.
. Select a virtual machine to open the *VirtualMachine details* page.
. On the *Details* tab, click the pod name to open the *Pod details* page.
. On the *General* tile, click the pod name to open the *Pod details* page.
. Click the *Logs* tab to view the logs.

View File

@@ -62,7 +62,7 @@ Troubleshoot {VirtProductName} components and VMs and resolve issues that trigge
xref:../../virt/support/virt-troubleshooting.adoc#events_virt-troubleshooting[Events]::
View important life-cycle information for VMs, namespaces, and resources.
xref:../../virt/support/virt-troubleshooting.adoc#virt-logs_virt-troubleshooting[Logs]::
xref:../../virt/support/virt-troubleshooting.adoc#virt-pod-logs_virt-troubleshooting[Logs]::
View and configure logs for {VirtProductName} components and VMs.
xref:../../virt/support/virt-troubleshooting.adoc#troubleshooting-data-volumes_virt-troubleshooting[Troubleshooting data volumes]::

View File

@@ -5,7 +5,7 @@ include::_attributes/common-attributes.adoc[]
:context: virt-troubleshooting
:toclevels: 4
{VirtProductName} provides tools and logs for troubleshooting virtual machines and virtualization components.
{VirtProductName} provides tools and logs for troubleshooting virtual machines (VMs) and virtualization components.
toc::[]
@@ -37,42 +37,58 @@ You can view resource events by running the following command:
$ oc describe <resource> <resource_name>
----
[id="virt-logs_{context}"]
== Logs
[id="virt-pod-logs_{context}"]
== Pod logs
You can review the following logs for troubleshooting:
You can view logs for {VirtProductName} pods by using the web console or the CLI. You can also view xref:../../virt/support/virt-troubleshooting.adoc#virt-viewing-logs-loki_virt-troubleshooting[aggregated logs] by using the LokiStack in the web console.
* xref:../../virt/support/virt-troubleshooting.adoc#viewing-virt-component-pods_virt-troubleshooting[Virtual machine]
* xref:../../virt/support/virt-troubleshooting.adoc#virt-viewing-logs-cli_virt-troubleshooting[{VirtProductName} pod]
* xref:../../virt/support/virt-troubleshooting.adoc#virt-viewing-logs-loki_virt-troubleshooting[Aggregated {VirtProductName} logs]
include::modules/virt-configuring-pod-log-verbosity.adoc[leveloffset=+2]
include::modules/virt-viewing-virtual-machine-logs-web.adoc[leveloffset=+2]
include::modules/virt-viewing-virt-launcher-pod-logs-web.adoc[leveloffset=+2]
[id="viewing-virt-component-pods_{context}"]
=== Viewing {VirtProductName} pod logs
include::modules/virt-viewing-logs-cli.adoc[leveloffset=+2]
You can view logs for {VirtProductName} pods by using the `oc` CLI tool.
[id="guest-system-logs_{context}"]
== Guest system logs
You can configure the verbosity level of the logs by editing the `HyperConverged` custom resource (CR).
Viewing the boot logs of VM guests can help diagnose issues. You can configure access to guests' logs and view them by using either the {product-title} web console or the `oc` CLI.
include::modules/virt-viewing-logs-cli.adoc[leveloffset=+3]
This feature is disabled by default. If a VM does not explicitly have this setting enabled or disabled, it inherits the cluster-wide default setting.
include::modules/virt-configuring-pod-log-verbosity.adoc[leveloffset=+3]
[IMPORTANT]
====
If sensitive information such as credentials or other personally identifiable information (PII) is written to the serial console, it is logged with all other visible text. Red Hat recommends using SSH to send sensitive data instead of the serial console.
====
include::modules/virt-common-error-messages.adoc[leveloffset=+3]
include::modules/virt-enable-guest-log-default-web.adoc[leveloffset=+2]
include::modules/virt-enable-guest-log-default-cli.adoc[leveloffset=+2]
include::modules/virt-set-guest-log-single-vm-web.adoc[leveloffset=+2]
include::modules/virt-set-guest-log-single-vm-cli.adoc[leveloffset=+2]
include::modules/virt-view-guest-system-logs-web.adoc[leveloffset=+2]
include::modules/virt-view-guest-system-logs-cli.adoc[leveloffset=+2]
[id="log-aggregation_{context}"]
== Log aggregation
You can facilitate troubleshooting by aggregating and filtering logs.
include::modules/virt-viewing-logs-loki.adoc[leveloffset=+2]
include::modules/virt-loki-log-queries.adoc[leveloffset=+3]
include::modules/virt-loki-log-queries.adoc[leveloffset=+2]
[role="_additional-resources"]
[id="additional-resources_{context}"]
==== Additional resources for LokiStack and LogQL
.Additional resources for LokiStack and LogQL
* xref:../../logging/log_storage/about-log-storage.adoc#about-log-storage[About log storage]
* xref:../../logging/log_storage/installing-log-storage.adoc#cluster-logging-loki-deploy_installing-log-storage[Deploying the LokiStack]
* link:https://grafana.com/docs/loki/latest/logql/log_queries/[LogQL log queries] in the Grafana documentation
include::modules/virt-common-error-messages.adoc[leveloffset=+1]
[id="troubleshooting-data-volumes_{context}"]
== Troubleshooting data volumes