有些客户的log中会发现一些奇怪的日志:
%x-x-x: Message from tty (xx): ----- xx
如:*Jul 10 01:04:28.510 EEST: %SYS-2-LOGMSG: Message from 322(dpetrov): "To be or not to be"
Mar 28 00:14:27.089 GZ: %SYS-2-LOGMSG: Message from TTY(admin): ----- Start Of the day
这是什么呢?为什么会有这样的日志呢?对设备有啥影响么?
首先检查了show run,发现并没有没有什么可疑的地方。经过查找资料和实践发现:
原来是如下的情况:
1/当配置“send log facility xseverity x mnemonics x”时,会以“%x-x-x:”的形式发送日志到log buffer里,且该命令只生效一次,在show run里不会体现。
如:
Switch#send log facility SYS severity 2mnemonics LOGMSG
Enter message, end with CTRL/Z; abort with CTRL/C:
^Z
Send message? [confirm]
Switch #
Switch#show log
*Mar 31 18:15:32.222: %SYS-2-LOGMSG: Message from tty0(user id:): <<<-------------
2/为了进一步确认该配置是否会对其它日志造成影响,对接口做shut/noshut操作,发现接口down/up的日志不会受影响,故该配置不会影响设备自身产生的日志:
Switch (config)#interface g2/0/1
Switch (config-if)#shut
Switch (config-if)#shutdown
Switch (config-if)#no shut
Switch (config-if)#no shutdown
Switch (config-if)#end
Switch#show log
*Mar 31 18:16:25.942: %LINK-5-CHANGED: InterfaceGigabitEthernet2/0/1, changed state to administratively down
*Mar 31 18:16:26.949: %LINEPROTO-5-UPDOWN: Line protocol onInterface GigabitEthernet2/0/1, changed state to down
*Mar 31 18:16:29.835: %LINK-3-UPDOWN: InterfaceGigabitEthernet2/0/1, changed state to up
*Mar 31 18:16:30.145: %SYS-5-CONFIG_I: Configured from consoleby console
*Mar 31 18:16:30.942: %LINEPROTO-5-UPDOWN: Line protocol onInterface GigabitEthernet2/0/1, changed state to up
3/进一步确认截图里的输出内容,分别测试输出内容为“test2”和"test5":
Switch#send log facility SYS severity 2mnemonics LOGMSG test2
Switch#show log
*Mar 31 18:19:49.979: %SYS-2-LOGMSG2: Message from tty0(user id:): test2 <<<-------------
-------------------------------------------------
Switch#send log "test5"
Switch#show log
*Mar 31 18:34:53.214: %SYS-2-LOGMSG: Message from 0():"test5" <<<-------------