Using a Remote Log Server
Problem
You want to send log messages to a remote syslog server.
Solution
Use the following command to send router log messages to a remote syslog server:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#logging
Router(config)#
172.25.1.1
end
Router#
Although configuring the router with a static IP address like this is the preferred method of configuring a syslog server, you can also specify a hostname to be resolved:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip host
Router(config)#
nms.oreilly.com 172.25.1.1
logging
Router(config)#
nms.oreilly.com
end
Router#
With this configuration, the router will attempt to resolve the server name that is provided. If the router cannot resolve the server name via DNS or static host lookup, then the entry will fail. For more information about DNS and static host names, please see Chapter 2.
Beginning with IOS Version 12.2(15)T, logging host replaced the logging command; however, both methods are still supported:
Router2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router2(config)#logging host
Router2(config)#
172.25.1.1
end
Router2#
Discussion
Forwarding log messages to a remote syslog server has several advantages over just retaining log messages locally on the router. The primary advantage is that messages sent to the server are stored to disk. All other forms of router logging are ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.