Sending Syslog Messages As SNMP Traps and Informs
Problem
You want to send syslog messages as SNMP traps or informs.
Solution
You can configure the router to forward syslog messages to your network management server as SNMP traps instead of syslog packets with the following configuration commands:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#logging history informational
Router(config)#snmp-server enable traps syslog
Router(config)#snmp-server host
172.25.1.1 ORATRAP
syslog
Router(config)#end
Router#
To forward syslog messages as SNMP informs, use the following configuration commands:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#logging history informational
Router(config)#snmp-server enable informs
Router(config)#snmp-server host
172.25.1.1
informs version 2c
ORATRAP
syslog
Router(config)#end
Router#
Discussion
Cisco routers normally forward syslog messages via the syslog facility by using UDP port 514. However, in networks that support SNMP traffic only, Cisco routers can encapsulate their syslog messages into SNMP traps before sending them.
This feature is most useful if your network management software doesn’t support the syslog protocol. However, since routers can produce many more syslog messages than SNMP traps, we recommend using syslog when possible. Further, the fact that all of the syslog messages sent as SNMP traps use the same OID number can make parsing for particular ...
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.