peer log-change
Use peer log-change to enable logging for BGP session state changes for a peer or peer group.
Use undo peer log-change to disable logging for BGP session state changes for a peer or peer group.
Syntax
peer { group-name | ipv4-address [ mask-length ] | ipv6-address [ prefix-length ] } log-change
undo peer { group-name | ipv4-address [ mask-length ] | ipv6-address [ prefix-length ] } log-change
Default
Logging for BGP session state changes is enabled for all peers or peer groups.
Views
BGP instance view
BGP-VPN instance view
Predefined user roles
network-admin
Parameters
group-name: Specifies a peer group by its name, a case-sensitive string of 1 to 47 characters. The peer group must already exist.
ipv4-address: Specifies the IPv4 address of a peer. The peer must already exist.
mask-length: Specifies a mask length in the range of 0 to 32. You can use the ipv4-address and mask-length arguments together to specify a subnet. If you specify a subnet, this command enables the logging of BGP session state changes for all dynamic peers in the subnet.
ipv6-address: Specifies the IPv6 address of a peer. The peer must already exist.
prefix-length: Specifies a prefix length in the range of 0 to 128. You can use the ipv6-address and prefix-length arguments together to specify a subnet. If you specify a subnet, this command enables the logging of BGP session state changes for all dynamic peers in the subnet.
Usage guidelines
After you execute both the log-peer-change and peer log-change commands, BGP logs session establishment and disconnection events for the peer or peer group. To view the log information, use the display bgp peer ipv4 unicast log-info command or the display bgp peer ipv6 unicast log-info command. The logs are sent to the information center of the device. The output rules of the logs (whether to output the logs and where to output) are determined by the information center configuration. For more information about information center configuration, see Network Management and Monitoring Configuration Guide.
If you disable logging for BGP session state changes globally or disable logging for a peer or peer group, BGP does not generate logs for session establishments and disconnections.
Examples
# In BGP instance view, enable logging for BGP session state changes for peer 1.1.1.1.
<Sysname> system-view [Sysname] bgp 100 [Sysname-bgp-default] peer 1.1.1.1 as-number 200 [Sysname-bgp-default] peer 1.1.1.1 log-change
Related commands
display bgp peer
log-peer-change