Is it possible to write an arbitrary line of text to the log of a Cisco IOS 12.x device?

I should like to be able to put in markers when fetching configs via TFTP and I would like to be able to have log lines á la

 May 30 14:14:00.000: %CONFIG-REMARK: Halfway through the script! Now on to SomethingThatMightFail!
 May 30 14:14:05.000: %CONFIG-REMARK: SomethingThatMightFail didn't fail! Woo! Continuing!
up vote 19 down vote accepted

You can use the send log command:

switch#send log Halfway through the script!

gives my on a Catalyst 3750 with IOS 12.2

May 31 16:36:18: %SYS-2-LOGMSG: Message from 1(name): Halfway through the script!

and with IOS 15.0:

May 31 16:38:08: %SYS-7-USERLOG_DEBUG: Message from tty1(user id: name): Halfway through the script!
  • Interesting feature. – Adam Loveless May 31 '13 at 14:34
  • Tasty and spot on. Vielen Dank, Stefan. – Jan May 31 '13 at 15:44
  • Note: 7600 with 12.2(33) gives same line as your IOS 15 example :-) – Jan May 31 '13 at 15:48

Assuming you're using TCL EEM you can use action_syslog.

  • Nope, no TCL anywhere in our network. Shell scripts using clogin. – Jan May 31 '13 at 13:46

The syntax for sending a test syslog from a Cisco device depends on software version; here are the command syntaxes I've seen, including, where available, the option for setting syslog severity:

Most Cisco platforms, if running IOS 12.2(58) and higher:

send log [severity] [text to send]
Eg:
send log
send log   This message will go to my syslog server.
send log 5 This message will go to my syslog server.

Most Cisco platforms, if running IOS 12.2(52) and lower:

send log [text to send]
Eg:
send log
send log   This message will go to my syslog server.

ASR1000 running IOS-XE 03.01.00, which is sourced from IOS 15.0(1):

send log [severity [text to send]]
Eg:
send log
send log 5 This message will go to my syslog server.

ASR1000 running other IOS-XE versions (including 02.04.03 from IOS 12.2(33), 03.04.04 from IOS 15.1(3), 03.14.00 from IOS 15.5(1)):

send log [severity] [text to send]
Eg:
send log
send log   This message will go to my syslog server.
send log 5 This message will go to my syslog server.

ASR9000 running IOS-XR 4.2.1 and higher:

log <text to send>
Eg:
log This message will go to my syslog server.

WS-C6513 running IOS 12.2(18): No equivalent command; you need to use another method to generate a syslog message. For example, the following should generate 5 syslogs (interface up, line protocol up, interface down, line protocol down, and configuration changed), depending on your logging settings. Leave out the 2 interface commands to generate just the one generic configuration-changed syslog.

config t
interface loopback601
no interface loopback601
end

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.