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 terminalEnter configuration commands, one per line. End with CNTL/Z. Router(config)#loggingRouter(config)#172.25.1.1endRouter#
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 terminalEnter configuration commands, one per line. End with CNTL/Z. Router(config)#ip hostRouter(config)#nms.oreilly.com 172.25.1.1loggingRouter(config)#nms.oreilly.comendRouter#
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 terminalEnter configuration commands, one per line. End with CNTL/Z. Router2(config)#logging hostRouter2(config)#172.25.1.1endRouter2#
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access