跳转到主内容

如何从ONTAP 9手动收集日志?

Views:
393
Visibility:
Public
Votes:
1
Category:
ontap-9
Specialty:
core
Last Updated:

适用于

  • ONTAP 9
  • 手动收集日志

描述

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

 NetApp支持部门可能会 请求手动收集节点中的所有文件。  使用以下操作步骤完成此请求。

不包括以下目录和文件:

  • /mroot/etc/log/stats
  • /mroot/etc/log/packet_traces
  • 任何名为corefile可能会发现/mroot/etc/log目录树

 

操作步骤

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

  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' | 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 ; systemshell local "ngsh -c 'set d -c off ; systemshell -node * rm /mroot/etc/log/mroot_bundle'" ; set admin -c on

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

  1. 从SPI集群Web界面中、将日志包下载 到客户端

网址是​​​​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 对中的正常运行节点。
  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.