Collecting Logs
Performing Check Before Collection
Use a remote access tool, such as PuTTY, to log in to the node where the oceanctl tool is installed in the Kubernetes cluster through the management IP address.
Run the following command. The displayed version is v4.5.0.
oceanctl version
The following is an example of the command output.
Oceanctl Version: v4.5.0
Run the oceanctl collect logs –help command. The following information is displayed.
$ oceanctl collect logs --help Collect logs of one or more nodes in specified namespace in Kubernetes Usage: oceanctl collect logs [flags] Examples: # Collect logs of all nodes in specified namespace oceanctl collect logs -n <namespace> # Collect logs of specified node in specified namespace oceanctl collect logs -n <namespace> -N <node> # Collect logs of all nodes in specified namespace oceanctl collect logs -n <namespace> -a # Collect logs of all nodes in specified namespace with a maximum of 50 nodes collected at the same time oceanctl collect logs -n <namespace> -a --threads-max=50 # Collect logs of specified node in specified namespace oceanctl collect logs -n <namespace> -N <node> -a Flags: -a, --all Collect all nodes messages -h, --help help for logs -n, --namespace string namespace of resources -N, --nodename string Specify the node for which information is to be collected. --threads-max int set maximum number[1~1000] of threads for nodes to be collected. (default 50) Global Flags: --log-dir string Specify the directory for printing log files. (default "/var/log/huawei")
Run the following command to check whether a Pod is started properly. In the command, huawei-csi indicates the namespace for installing CSI.
kubectl get deployment -n huawei-csi
The following is an example of the command output.
NAME READY UP-TO-DATE AVAILABLE AGE huawei-csi-controller 1/1 1 1 21h
Collecting All Logs in the CSI Namespace Using oceanctl
Use a remote access tool, such as PuTTY, to log in to the node checked in Performing Check Before Collection through the management IP address.
Run the oceanctl collect logs -n <namespace> -a –threads-max=<max_node_processing_num> command to collect CSI logs of all nodes where CSI containers reside in the cluster. In the command, threads-max indicates the maximum number of nodes for which logs can be collected at the same time. The default value is 50. You can set the value based on the host performance and load.
oceanctl collect logs -n huawei-csi -a --threads-max=10
Check the log package generated in the /tmp directory. You can run the unzip <zip_name> -d collect_logs command to decompress the log package. In the preceding command, <zip_name> indicates the package name.
# date Wed Sep 20 02:49:24 EDT 2023 # ls huawei-csi-2023-09-20-02:48:22-all.zip
Collecting the Log of a Single CSI Node Using oceanctl
Use a remote access tool, such as PuTTY, to log in to the node checked in Performing Check Before Collection through the management IP address.
Run the **oceanctl collect logs -n <namespace> -N **<nodeName> command to collect CSI logs of all nodes where CSI containers reside in the cluster.
oceanctl collect logs -n huawei-csi -N node-1
Check the log package generated in the /tmp directory. You can run the unzip <zip_name> -d collect_logs command to decompress the log package. In the preceding command, <zip_name> indicates the package name.
# date Thu Sep 21 04:08:47 EDT 2023 # ls huawei-csi-2023-09-21-04:05:15-node-1.zip