跳转到主内容

如何从 ONTAP 9 手动收集日志

Views:
1,167
Visibility:
Public
Votes:
2
Category:
ontap-9
Specialty:
core
Last Updated:

适用于

  • ONTAP 9
  • 手动日志收集

说明

  • AutoSupport 仅收集写入每个日志文件的最新日志消息。
  • 非常活跃的日志记录可能会触发日志轮换,某些日志可能无法在 AutoSupport 消息中捕获。有关更多详细信息,请参见 ONTAP 日志概述
  • 由于负载限制,某些诊断日志不包含在 AutoSupport 消息中。

 NetApp 支持人员可能会要求从节点手动收集所有文件。  使用以下步骤完成此请求。

不包括以下目录和文件:

  • /mroot/etc/log/stats
  • /mroot/etc/log/packet_traces
  • 可能在 /mroot/etc/log  目录树中找到的任何名为 corefile  的文件

 

操作步骤

如何从未处于接管状态的节点收集日志

  1. 运行以下命令来收集完整的日志:

::> set d -c off ; systemshell local "date +%Y%m%d%H%M%S | xargs -I DATE -n1 ngsh -c 'set d -c off ; cluster application-record create -name mroot_bundle_tracker -value DATE -vserver 4294967295'" ; systemshell * "echo `ngsh -c 'set d -c off ; cluster application-record show -vserver 4294967295' | grep mroot | awk '{print $3}'` > /mroot/etc/log/mroot_bundle" ; systemshell -node * -command "sudo find -L /mroot/etc/log -depth -print | egrep -v '\/log\/stats\/|\/log\/packet_traces\/|\/log\/mfg\/|\/corefile' | sudo tar -cLnvzf /mroot/etc/crash/`hostname`_etc-logs.tar.gz -T -" ; cluster application-record delete -name mroot_bundle_tracker -vserver 4294967295 ; systemshell local "ngsh -c 'set d -c off ; systemshell -node * rm /mroot/etc/log/mroot_bundle'" ; set admin -c on

注意: 该命令会创建一个压缩的 tar 文件,其中包含目录中的所有文件  /mroot/etc/crash。 

注意:如果您收到错误消息:"Account currently locked",请使用以下方法解锁 diag 帐户:如何解锁 Systemshell diag 用户帐户

  1. 从 SPI 集群 Web 界面,将日志捆绑包下载到客户端。  URL 为​​​​ https://<cluster-mgmt-ip>/spi/<node_name>/etc/crash/ 
  1. 下载文件后,将其从节点中删除。 

该文件可能很大,如果不加处理,将不必要地占用根卷空间。

a.  列出并标识创建的文件:

::> set diag

::*> systemshell -node * -command "ls /mroot/etc/crash/*.tar.gz"  
  
Node: node-1
/mroot/etc/crash/node-1_etc-logs_202505301028.tar.gz
 
Node: node-2
/mroot/etc/crash/node-2_etc-logs_202505301028.tar.gz
2 entries were acted on.

b. 删除这些文件:

注意:使用 Systemshell rm 命令时请谨慎。不正确的使用可能会影响系统。避免使用通配符。 

::*> systemshell -node node-1 -command "rm /mroot/etc/crash/node-1_etc-logs_202505301028.tar.gz"

::*> systemshell -node node-2 -command "rm /mroot/etc/crash/node-2_etc-logs_202505301028.tar.gz"

c. 检查文件是否已删除:

::*> systemshell -node * -command "ls /mroot/etc/crash/*.tar.gz"
 
Node: node-1
ls: No match.
 
Node: node-2
ls: No match.
2 entries were acted on.

  1. 将文件放在本地客户端上后,请使用本文中建议的方法之一将每个文件单独上传到 NetApp:如何将文件上传到 NetApp? 

注意:请勿将多个日志捆绑文件压缩或 tar 到单个文件中。  请分别上传每个文件。

如何从接管中的节点收集日志 

  1. 连接到 HA 对中的 up 节点。
  2. 将步骤 1 替换为以下内容: 

set d -c off ; systemshell local "sudo mount_partner"; systemshell local "date +%Y%m%d%H%M%S | xargs -I DATE -n1 ngsh -c 'set d -c off ; cluster application-record create -name mroot_bundle_tracker -value DATE -vserver 4294967295'" ; systemshell local -command "sudo find -L /partner/etc/log -depth -print | egrep -v '\/log\/stats\/|\/log\/packet_traces\/|\/log\/mfg\/|\/corefile' | sudo tar -cLnvzf /mroot/etc/crash/partner_etc-logs_`ngsh -c 'set d -c off ; cluster application-record show' | grep mroot | awk '{print $3}'`.tar.gz -T -" ; cluster application-record delete -name mroot_bundle_tracker ; systemshell local "sudo umount /partner"; set admin -c on

注意:文件名格式为 partner_etc-logs_202506021448.tar.gz ,不含节点名称。  如有需要,请重命名。

  1. 继续执行上一节中的步骤 2 
NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.