To log system
messages and debug output to a remote host, use the
logging
host command in global configuration mode. To
remove a specified logging host from the configuration, use the
no form of this
command.
logging host { {ip-address | hostname} [vrf vrf-name] | ipv6 {ipv6-address | hostname}} [discriminator discr-name | [filtered [stream stream-id] | xml]] [transport { [beep [audit] [channel chnl-number] [sasl profile-name] [tls cipher [cipher-num] trustpoint trustpt-name]] | tcp [audit] | udp} [port port-num]] [sequence-num-session] [session-id {hostname | ipv4 | ipv6 | string custom-string}]
no logging host { {ip-address | hostname} | ipv6 {ipv6-address | hostname}}
Syntax Description
ip-address
|
IP
address of the host that will receive the system logging (syslog) messages.
|
hostname
|
Name of
the IP or IPv6 host that will receive the syslog messages.
|
vrf
vrf-name
|
(Optional) Specifies a VPN routing and forwarding instance (VRF) that connects
to the syslog server host. Name of the VRF that connects to the syslog server
host.
|
ipv6
|
Indicates that an IPv6 address will be used for a host that will receive the
syslog messages.
|
ipv6-address
|
IPv6
address of the host that will receive the syslog messages.
|
discriminator
discr-name
|
(Optional) Specifies a message discriminator for the session. Name of the
message discriminator.
|
filtered
|
(Optional) Specifies that logging messages sent to this host should first be
filtered by the Embedded Syslog Manager (ESM) syslog filter modules specified
in the
logging
filter commands.
|
stream
stream-id
|
(Optional) Specifies that only ESM filtered messages with the stream
identification number specified in the
stream-id
argument should be sent to this host. Number from 10 to 65535 that identifies
the message stream.
|
xml
|
(Optional) Specifies that the logging output should be tagged using the XML
tags defined by Cisco.
|
transport
|
(Optional) Method of transport to be used. UDP is the default.
|
beep
|
(Optional) Specifies that the Blocks Extensible Exchange Protocol (BEEP)
transport will be used.
|
audit
|
(Optional) Available only for BEEP and TCP. When the
audit keyword
is used, the specified host is identified for firewall audit logging.
|
channel
chnl-number
|
(Optional) Specifies the BEEP channel number to use. Number of the BEEP
channel. Valid values are 1, 3, 5, 7, 9, 11, 13, and 15. The default is 1.
|
sasl
|
(Optional) Applies the Simple Authentication and Security Layer (SASL) BEEP
profile.
|
profile-name
|
(Optional) Name of the SASL profile.
|
tls
cipher
|
(Optional) Specifies the cipher suites to be used for a connection. Cipher
suites are referred to by mask values. Multiple cipher suites can be chosen by
adding the mask values. The
tls
cipher
cipher-num keyword and argument pair is available
only in crypto images.
|
cipher-num
|
(Optional) Integer from 32 to 224 that is the mask value of a cipher suite (sum
of up to three numbers: 32, 64, and 128) and refers to the following:
-
ENC_FLAG_TLS_RSA_WITH_NULL_SHA - 32
-
ENC_FLAG_TLS_RSA_WITH_RC4_128_MD5 - 64
-
ENC_FLAG_TLS_RSA_WITH_AES_128_CBC_SHA - 128
The
tls
cipher
cipher-num keyword and argument pair is available
only in crypto images.
|
trustpoint
trustpt-name
|
(Optional) Specifies a trustpoint for identity information and certificates.
The
trustpoint
trustpt-name keyword and argument pair is
available only in crypto images. Name of the trustpoint. If you previously
declared the trustpoint and want only to update its characteristics, specify
the name you previously created. The
trustpoint
trustpt-name keyword and argument pair is
available only in crypto images.
|
tcp
|
(Optional) Specifies that the TCP transport will be used.
|
udp
|
(Optional) Specifies that the UDP transport will be used.
|
port
port-number
|
(Optional) Specifies that a port will be used.
Integer
from 1 through 65535 that defines the port.
If a
port number is not specified, the standard Cisco default port number for TCP is
601, for BEEP is 601, and for UDP is 514.
|
sequence-num-session
|
(Optional) Includes a session sequence number tag in the syslog message.
|
session-id
|
(Optional) Specifies syslog message session ID tagging.
|
hostname
|
Includes the hostname in the session ID tag.
|
ipv4
|
Includes the logging source IP address in the session ID tag.
|
ipv6
|
Includes the logging source IPv6 address in the session ID tag.
|
string
custom-string
|
Includes the custom string in the session ID tag.
Custom
string in the s_id="custom_string" tag.
|
Command Default
System logging
messages are not sent to any remote host. When this command is entered without
the
xml or
filtered
keyword, messages are sent in the standard format.
Command Modes
Global configuration (config)
Command History
T
Release
|
Modification
|
10.0
|
The
logging
command was introduced.
|
12.2(15)T
|
The
logging
host command replaced the
logging
command. The
xml keyword
was added.
|
12.3(2)T
|
The
filtered [stream]
stream-id syntax was added as part of the ESM
feature.
|
12.3(14)T
|
The
transport
keyword was added.
|
12.4(4)T
|
The
ipv6
ipv6-address keyword-argument pair was added.
|
12.4(11)T
|
Support
for BEEP and the
discriminator ,
sequence-num-session , and
session-id
keywords and
discr-name
argument was added.
|
S
Release
|
Modification
|
12.0(14)S
|
The
logging
host command replaced the
logging
command.
|
12.0(14)ST
|
The
logging
host command replaced the
logging
command.
|
12.2(25)S
|
This
command was integrated into Cisco IOS Release 12.2(25)S and the
vrf
vrf-name keyword-argument pair was added.
|
SR
Release
|
Modification
|
12.2(33)SRA
|
This
command was integrated into Cisco IOS Release 12.2(33)SRA. The
vrf
vrf-name and
xml keywords
were supported.
|
SX Release
|
Modification
|
12.2(33)SXH
|
This
command was integrated into Cisco IOS Release 12.2(33)SXH. Support was added
for
vrf
vrf-name and
xml keywords
and argument.
|
12.2(33)SXI
|
Support
for BEEP and the
discriminator ,
sequence-num-session , and
session-id
keywords and
discr-name
argument were added.
|
XE Release
|
Modification
|
12.3(2)XE
|
This
command was integrated into Cisco IOS Release 12.3(2)XE.
|
SB Release
|
Modification
|
12.2(28)SB
|
This
command was integrated into Cisco IOS Release 12.2(28)SB. Support was added for
the
vrf
vrf-name and
xml keywords
and argument.
|
12.2(31)SB2
|
This
command was implemented on the Cisco 10000 series routers. Support was added
for the
vrf
vrf-name and
xml keywords
and argument.
|
Usage Guidelines
Standard system
logging is enabled by default. If logging is disabled on your system (using the
no
logging
on command), you must enter the
logging
on command to reenable logging before you can use
the
logging
host command.
The
logging
host command identifies a remote host (usually a
device serving as a syslog server) to receive logging messages. By issuing this
command more than once, you can build a list of hosts that receive logging
messages.
To specify the
severity level for logging to all hosts, use the
logging
trap command.
Use the
vrf
vrf-name keyword and argument to enable a syslog
client (a provider edge [PE] router) to send syslog messages to a syslog server
host connected through a VRF interface. To delete the configuration of the
syslog server host from the VRF, use the
no
logging
host command with the
vrf
vrf-name keyword and argument.
When
XML-formatted syslog is enabled using the
logging
host command with the
xml keyword,
messages are sent to the specified host with the system-defined XML tags. These
tags are predefined and cannot be configured by a user. XML formatting is not
applied to debug output.
If you are using
the ESM feature, you can enable ESM-filtered syslog messages to be sent to one
or more hosts using the
logging
host
filtered command. To use the ESM feature, you must
first specify the syslog filter modules that should be applied to the messages
using the
logging
filter command. See the description of the
logging
filter command for more information about the ESM
feature.
 Note |
ESM and message
discriminator usage is mutually exclusive in a given syslog session.
|
Using the BEEP
transport protocol, you can have reliable and secure delivery for syslog
messages and configure multiple sessions over eight BEEP channels. The
sasl
profile-name ,
tls
cipher
cipher-num ,
trustpoint
trustpt-name keywords and arguments are available
only in crypto images.
To configure
standard logging to a specific host after configuring XML-formatted or
ESM-filtered logging to that host, use the
logging
host command without the
xml or
filtered
keyword. Issuing the standard
logging
host command replaces an XML- or ESM-filtered
logging
host command, and vice versa, if the same host is
specified.
You can configure
the system to send standard messages to one or more hosts, XML-formatted
messages to one or more hosts, and ESM-filtered messages to one or more hosts
by repeating this command as many times as desired with the appropriate syntax.
(See the “Examples” section.)
When the
no
logging
host command is issued with or without the
optional keywords, all logging to the specified host is disabled.
Examples
In the following
example, messages at severity levels 0 (emergencies) through 5 (notifications)
(logging
trap command severity levels) are logged to a host
at 192.168.202.169:
Router(config)# logging host 192.168.202.169
Router(config)# logging trap 5
In the following
example, standard system logging messages are sent to the host at
192.168.200.225, XML-formatted system logging messages are sent to the host at
192.168.200.226, ESM-filtered logging messages with the stream 10 value are
sent to the host at 192.168.200.227, and ESM-filtered logging messages with the
stream 20 value are sent to host at 192.168.202.129:
Router(config)# logging host 192.168.200.225
Router(config)# logging host 192.168.200.226 xml
Router(config)# logging host 192.168.200.227 filtered stream 10
Router(config)# logging host 192.168.202.129 filtered stream 20
In the following
example, messages are logged to a host with an IP address of 172.16.150.63
connected through a VRF named vpn1:
Router(config)# logging host 172.16.150.63 vrf vpn1
In the following
example, the default UDP on an IPv6 server is set because no port number is
specified. The default port number of 514 is used:
Router(config)# logging host ipv6 AAAA:BBBB:CCCC:DDDD::FFFF
In the following
example, TCP port 1774 on an IPv6 server is set:
Router(config)# logging host ipv6 BBBB:CCCC:DDDD:FFFF::1234 transport tcp port 1774
In the following
example, the UDP port default is used on an IPv6 server with a hostname of
v6-hostname:
Router(config)# logging host ipv6 v6-hostname transport udp port 514
In the following
example, a message discriminator named fltr1 is specified along with the BEEP
protocol for port 600 and channel 3.
Router(config)# logging host host2 dicriminator fltr1 transport beep channel 3 port 600