Dell Networking SONiC 如何配置交换机以将日志发送到系统日志服务器

Summary: 本文介绍如何配置 Dell Networking SONiC 交换机以将日志发送到系统日志服务器。本文使用运行 Dell SONiC 4.1 的交换机。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

 

先决条件
我们使用标准接口命名来演示概念。请参阅文章 Dell Networking S 系列:基本接口配置 — SONIC 4.0 ,了解有关接口命名的更多信息
 


指数

介绍
配置系统日志服务器
配置
示例输出示例 

 

简介

默认情况下,系统不会向任何服务器发送系统日志消息。要在远程服务器中保存系统日志消息,您可以将系统配置为将系统日志发送到远程服务器。

您还可以配置可选的源接口,以便系统可以使用该接口的 IP 地址作为源 IP 地址。如果不配置源接口,系统将使用出站接口的接口 IP 地址作为源 IP 地址。如果接口包含多个 IP 地址,系统将使用主 IP 地址。

Dell SONiC 依靠 UDP 将日志消息传输到系统日志服务器。默认情况下,Dell SONiC 使用 UDP 端口 514 作为向服务器发送系统日志消息的目标端口。

 

配置系统日志服务器

要配置远程系统日志服务器,请使用此全局命令。
Add a syslog server

admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)#logging server {hostname | ip-address | ipv6-address} [source-interface interfacetype] [remote-port port-number] [vrf vrf-name] [message-type type] [severity level] 
[vrf vrf-name]
说明
  • 主机 名- 输入系统日志服务器的主机名。
  • ip 地址 — 输入系统日志服务器的 IP 地址。
  • ipv6-address — 输入系统日志服务器的 IPv6 地址。
  • 源接口接口类型 - (可选)输入以太网、环回、管理、端口通道或 VLAN 接口 IP 地址,以便在发送数据包时用作源接口。
  • remote-port 端口号 - (可选)输入远程端口号。范围为 1 到 65535。默认远程端口为 UDP 514
  • 消息类型类型 - (可选)您可以将:日志或事件配置为消息类型。默认消息类型为日志。
  • 严重性级别 —(可选)输入要发送到系统日志服务器的日志的严重性级别。只有具有指定和更高严重性级别的日志才会发送到配置的系统日志服务器。严重性级别较低的日志不会转发到远程服务器。要将所有日志转发到系统日志服务器,系统日志严重性可以设置为最高级别 7 调试。
               级别包括:调试(7)、信息(6)、通知(5)、警告(4)、错误(3)、crit(2)、alert(1)、emerg(0)。默认远程严重性级别为 notice 。
  • vrf vrf-name - (可选)输入用于发送系统日志消息的 VRF 的名称。
 
Remove syslog server

DELLSONiC# configure
DELLSONiC(config)# no logging server {hostname | ip-address | ipv6-address} 
 

示例配置


以下示例将系统配置为将系统日志消息发送到 10.59.142.126。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# logging server 10.59.142.126

以下示例将系统配置为将系统日志消息发送到 10.59.142.125,并显示严重性级别错误。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# logging server 10.59.142.130 severity error

以下示例将系统配置为将系统日志消息发送到 10.59.143.28,其中环回 1 作为源接口,以及从 VRF1 发送。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# logging server 10.59.143.28 source-interface Loopback 1 vrf Vrf1

以下示例将系统配置为将系统日志消息发送到 10.59.136.33,其中 Eth1/1 作为源接口。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)#  logging server 10.59.136.33 source-interface Eth1/1
  
 

输出示例 

使用命令 show logging servers 查看系统日志服务器
 
DELLSONiC# show logging servers
--------------------------------------------------------------------------------------
HOST            PORT      SOURCE-INTERFACE    VRF            MESSAGE-TYPE   SEVERITY
--------------------------------------------------------------------------------------
10.59.136.33    514       Eth1/1              -              log            notice
10.59.142.126   514       -                   -              log            notice
10.59.142.130   514       -                   -              log            error
10.59.143.28    514       Loopback1           Vrf1           log            notice

Affected Products

PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch Z9264F-ON, PowerSwitch Z9332F-ON, PowerSwitch Z9432F-ON
Article Properties
Article Number: 000218235
Article Type: How To
Last Modified: 06 Oct 2023
Version:  2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.