簡介
本檔案介紹有關備援Configuration Manager(RCM)日誌收集的一般程式。
RCM日誌收集過程
以下是RCM的元件:
- 控制器
- 檢查點管理器
- BFDMGR
- OPScenter
- Configmgr
根據問題場景,必須精確定位可作為捕獲日誌基礎的棘手元素。
所有元件的步驟都相同,如下所述。
-
如果您需要檢視最近的日誌,例如最近1到2小時內的日誌,您可以簡單地收集該特定元件的Pod日誌。
kubectl get svc -o wide -A -n rcm
With this command, you get all the pods with their IPs and name.
kubectl logs <pod name> -n rcm
Just mention the pod name for which logs are required.
- 如果需要檢查超過2小時的日誌,RCM系統最多儲存所有生成的日誌4天。您可以按照此處列出的步驟檢索它們。
1.導航到目錄路徑: /var/log/containers
並使用 grep
命令,以搜尋所需的特定元件日誌。
In this scenario, let's take the controller as an example. If you require logs for configmgr/checkpointmgr, you need to use the 'grep' command, while the rest of the procedure remains unchanged.
root@h10-126-83-128:/var/log/containers# ls -la | grep controller
lrwxrwxrwx 1 root root 107 Mar 29 07:07 rcm-controller-6547b466ff-zsrcd_rcm_rcm-controller-4c149c1e962992a241dd5201aadb07237f52947740724c1df2a01b1b6bfbc671.log -> /var/log/pods/rcm_rcm-controller-6547b466ff-zsrcd_ff74e5fc-9a07-4073-8956-90cd978ac98e/rcm-controller/0.log
2.查詢控制器目錄。
From Step 1., you can see the controller directory as mentioned here:
/var/log/pods/rcm_rcm-controller-6547b466ff-zsrcd_ff74e5fc-9a07-4073-8956-90cd978ac98e/rcm-controller/0.log
Get into this path
root@h10-126-83-128:/var/log/containers# ls -la /var/log/pods/rcm_rcm-controller-6547b466ff-zsrcd_ff74e5fc-9a07-4073-8956-90cd978ac98e/rcm-controller/
total 12
drwxr-xr-x 2 root root 4096 Mar 29 07:07 .
drwxr-xr-x 3 root root 4096 Mar 29 07:07 ..
lrwxrwxrwx 1 root root 165 Mar 29 07:07 0.log -> /var/lib/docker/containers/4c149c1e962992a241dd5201aadb07237f52947740724c1df2a01b1b6bfbc671/4c149c1e962992a241dd5201aadb07237f52947740724c1df2a01b1b6bfbc671-json.log
3.獲取所有 .log
檔案(tar/zipped)。
In Step 2, once you have obtained the path where log files are stored, navigate to that path and collect the .log/.gz files as needed.
root@h10-126-83-128:/var/log/containers# ls -la /var/lib/docker/containers/4c149c1e962992a241dd5201aadb07237f52947740724c1df2a01b1b6bfbc671/
total 6448
drwx------ 4 root root 4096 Mar 29 07:07 .
drwx------ 69 root root 12288 Mar 29 07:07 ..
-rw-r----- 1 root root 6548746 Mar 29 10:08 4c149c1e962992a241dd5201aadb07237f52947740724c1df2a01b1b6bfbc671-json.log
drwx------ 2 root root 4096 Mar 29 07:07 checkpoints
-rw------- 1 root root 23306 Mar 29 07:07 config.v2.json
-rw-r--r-- 1 root root 2469 Mar 29 07:07 hostconfig.json
drwx------ 2 root root 4096 Mar 29 07:07 mounts
root@h10-126-83-128:/var/log/containers#