跳转到主内容

事件转发到 Syslog 服务器

i
Knowledge Base guidance

This article may include metadata, visibility, validation state, and related support guidance.

 

适用于

  • ONTAP 9
  • 集群模式 Data ONTAP 8
  • Data ONTAP 7-模式

问题解答

概述
  • Syslog 是事件触发的消息,严重程度不一
  • EMS 事件遵循 syslog 标准
  • 该标准由 IETF 在 RFC 5424 中定义

如何配置 Syslog 转发

一般来说,配置 Syslog 转发包括三个步骤
  1. 在 ONTAP 中创建 syslog 目标服务器
    • cluster-1::> event notification destination create -name syslog-ems -syslog syslog-server-address
  2. 创建一个事件过滤器,用于识别您希望转发到所选目标服务器的 EMS 事件列表
  3. 创建事件通知以将选定的事件过滤器转发到系统日志服务器:
    • cluster-1::> event notification create -filter-name important-raid-events -destinations syslog-ems
有关 ONTAP 中的 Syslogging 的其他指南

7-Mode 与集群模式 Data ONTAP 之间的区别

ONTAP 9

::> event route remove-destinations -message-name !callhome.* -destinations *

::> event route modify -message-name callhome.* -destinations asup

集群模式 Data ONTAP (8.X)
  •  在集群模式 Data ONTAP 中,/etc/syslog.conf 文件已被弃用
  • 因此,发送到远程 syslog 主机的内容由设置控制
  • Syslog 可以使用事件路由和事件目标命令设置
7-模式
  • 在 Data ONTAP 7-Mode 中,syslogd 守护进程会将系统消息记录到控制台、日志文件和其他远程系统,如其配置文件 /etc/syslog.conf 所指定
  • syslogd 守护进程在启动过程中启动时或 /etc/syslog.conf 文件修改后 30 秒内读取其配置文件
  • 有关配置文件格式的信息,请参阅 na_syslog.conf(5)
    • 7-Mode 下配置文件的示例
 # Log all kernel messages, and anything of level err or # higher to the console. *.err;kern.* /dev/console # Log anything of level info or higher to /etc/messages. *.info /etc/messages # Also log the messages that go to the console to a remote # loghost system called adminhost. *.err;kern.* @adminhost # Also log the messages that go to the console to the local7 # facility of another remote loghost system called adminhost2 # at level info. *.err;kern.* local7.info@adminhost2 # The /etc/secure.message file has restricted access. auth.notice /etc/secure.message
 

什么是 Syslog 翻译器?

故障排除

  • 在排除与 Syslog 相关的问题时,最常见的问题包括:
    • 配置问题
      •  查看上面链接的设置指南和相关文章,以获取更多帮助
    • 与 syslog 服务器的连接
      • 对于连接测试:
        • 如果您在 Syslog 服务器上无法接收消息,则可以使用免费的数据包捕获程序,如 Wireshark。
        • 此程序允许捕获发送到网络接口卡(NIC)的数据包。通过过滤和分析此流量,您将能够确定您的网络设备是否实际将预期的信息发送到您的系统
从 syslog 服务器测试连接(网络)问题:
  1. 下载并安装程序 Wireshark
  2. 使用"捕获"菜单打开"捕获选项"表单
  3. 选择连接到 ONTAP 节点的 NIC,并定义一个捕获过滤器,该过滤器将查找发送到 UDP 端口 514(默认 syslog 端口)的所有数据包
  4. 按"开始"按钮,您将看到正在发送的数据包
  5. 停止捕获并查看数据。它应该显示协议为 Syslog 的数据包
  6. 如果您没有收到任何消息,请使用 ping 和 traceroute 命令检查与您的 syslog 服务器的连接
ONTAP 9
  • 在 ONTAP 9 中,您可以运行以下命令来验证 EMS 消息是否已创建,并验证与 syslog 服务器的连接

::> set diag

::*> event notification destination check -node {nodename>|local} -destination-name <dest>   

::*> event notification history show

  • 事件通知目标检查 命令通过向目标发送测试消息来检查与目标的连接
    • 必须已通过使用事件通知目标命令配置目标
    • 该命令显示指示消息是否已成功发送到目标的结果
    • 如果发生故障,可以在 notifyd.log 文件中找到更多详细信息
      • 注意:目前此命令只能检查与 rest-api 类型目标的连接
  • event notification history show 命令显示已发送到通知目的地的事件消息列表
    • 每个事件的命令显示的信息与 event log show 命令的信息相同
    • 此命令显示发送到通知目的地的事件,而 event log show 命令显示已记录的所有事件