< Home

Example for Outputting Logs to a Log Host

Networking Requirements

As shown in Figure 1, SwitchA connects to four log hosts. Log hosts are required to have reliability and receive logs of different types so that the network administrator can monitor logs generated by different modules on SwitchA.

Figure 1 Networking diagram for outputting logs to a log host

Configuration Roadmap

The configuration roadmap is as follows:

  1. Enable the information center.

  2. Configure SwitchA to send logs of notification generated by the ARP module to Server1, and specify Server3 as the backup of Server1. Configure SwitchA to send logs of warning generated by the AAA module to Server2, and specify Server4 as the backup of Server2.

  3. Configure the log host on the server so that the network administrator can receive logs generated by SwitchA on the log host.

Procedure

  1. Enable the information center.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] info-center enable
    

  2. Configure a channel and a rule for outputting logs to a log host.

    # Name a channel.

    [SwitchA] info-center channel 6 name loghost1
    [SwitchA] info-center channel 7 name loghost2
    

    # Configure a channel for outputting logs to a log host.

    [SwitchA] info-center loghost 10.1.1.1 channel loghost1
    [SwitchA] info-center loghost 10.1.1.2 channel loghost1
    [SwitchA] info-center loghost 10.2.1.1 channel loghost2
    [SwitchA] info-center loghost 10.2.1.2 channel loghost2
    

    # Configure a rule for outputting logs to a log host.

    [SwitchA] info-center source arp channel loghost1 log level notification
    [SwitchA] info-center source aaa channel loghost2 log level warning
    

  3. Configure an IP address for the interface that sends log information.

    [SwitchA] vlan 100
    [SwitchA-vlan100] quit
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type hybrid
    [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 100
    [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 100
    [SwitchA-GigabitEthernet0/0/1] quit
    [SwitchA] interface vlanif100
    [SwitchA-Vlanif100] ip address 172.16.0.1 255.255.255.0
    [SwitchA-Vlanif100] return

  4. Configure the log host on the server.

    The Switch can generate many logs, which may exceed the limited storage space of the Switch. To address this problem, configure a log server to store all the logs.

    The log host can run the Unix or Linux operating system or run third-party log software. For details about the configuration procedure, see the relevant documentation.

  5. Verify the configuration.

    # View the configuration of the log host.

    <SwitchA> display info-center
    Information Center:enabled
    Log host:
            10.1.1.1, channel number 6, channel name loghost1,
    language English , host facility local7
            10.1.1.2, channel number 6, channel name loghost1,
    language English , host facility local7
            10.2.1.1, channel number 7, channel name loghost2,
    language English , host facility local7
            10.2.1.2, channel number 7, channel name loghost2,
    language English , host facility local7
    Console:
            channel number : 0, channel name : console
    Monitor:
            channel number : 1, channel name : monitor
    SNMP Agent:
            channel number : 5, channel name : snmpagent
    Log buffer:
            enabled,max buffer size 1024, current buffer size 512,
    current messages 26, channel number : 4, channel name : logbuffer
    dropped messages 0, overwritten messages 0
    Trap buffer:
            enabled,max buffer size 1024, current buffer size 256,
    current messages 11, channel number:3, channel name:trapbuffer
    dropped messages 0, overwritten messages 0
    logfile:
            channel number : 9, channel name : channel9, language : English  
    Information timestamp setting:
            log - date, trap - date, debug - date millisecond
    
     Sent messages = 273456, Received messages = 284845
    
     IO Reg messages = 2 IO Sent messages = 11389
    

Configuration Files

SwitchA configuration file

#
sysname SwitchA
#
info-center channel 6 name loghost1
info-center channel 7 name loghost2
info-center source ARP channel 6 log level notification
info-center source AAA channel 7 log level warning
info-center loghost 10.1.1.1 channel 6
info-center loghost 10.1.1.2 channel 6
info-center loghost 10.2.1.1 channel 7
info-center loghost 10.2.1.2 channel 7
#
vlan batch 100
#
interface Vlanif100
 ip address 172.16.0.1 255.255.255.0
# 
interface GigabitEthernet0/0/1
 port link-type hybrid
 port hybrid pvid vlan 100
 port hybrid untagged vlan 100
# 
return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >