Send custom message to syslog

Answered Question
Jul 9th, 2009
User Badges:

Hello guys,

I'm trying to remember what was the command to create a custom messages and send them to the syslog? It was something like 'log send 5 "bla bla bla"' where 5 is facility which should be used when logging "bla bla bla" message to syslog. I tried to find id in command reference but I couldn't find anything.


Thank you in advance!

Correct Answer by Lucien Avramov about 7 years 9 months ago

There was an enhancement request on this. If you open a TAC case, they will be able to publish this for you so you will have an external document. They can contact lavramov for more information.


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.3 (4 ratings)
Loading.
Lucien Avramov Thu, 07/09/2009 - 13:33
User Badges:
  • Red, 2250 points or more

You can use EEM to produce your own syslog messages, no log command that I know of to create a syslog on the router CLI and send it, that I know of.


Lucien Avramov Thu, 07/09/2009 - 13:57
User Badges:
  • Red, 2250 points or more

Send log XY

Will display on the console the message XY

If you have logging console enabled, then this will send the syslog message XY to the logging server


You can not change the facility though



danailpetrov Thu, 07/09/2009 - 14:07
User Badges:

I'm not quite sure about that. Check this out:


border#send log "To be or not to be"

border#show log | i Console

Console logging: disabled


*Jul 10 01:04:28.510 EEST: %SYS-2-LOGMSG: Message from 322(dpetrov): "To be or not to be"

Even though the console logging is disabled, the log has been successfully sent to the syslog.

I'm 99% sure that I've used command like this to log a few comments as a "history" for my colleagues. In "J" company there is a command like "commit comment 'comment ...'" and I'm sure that I've found an analog for this in Cisco's IOS.


Thank you for your time!


Kind regards,

Danail Petrov


P.s. Nashenec? :)

Lucien Avramov Thu, 07/09/2009 - 14:13
User Badges:
  • Red, 2250 points or more

You are right, even without console logging, send log sends it.

But i dont see how you can change the syslog facility level for send log. It stays as level 2.


danailpetrov Thu, 07/09/2009 - 14:18
User Badges:

As I said, I'm 99% sure that I've found a way to do this. I can't remember now but I've done it :) I even tried to search back in our TACACS+ accounting information to find something - unfortunately without any success.



Lucien Avramov Thu, 07/09/2009 - 15:06
User Badges:
  • Red, 2250 points or more

On the platforms running 12.2(32)SRB and above, there is actually a command : send log


The message will then appear as :

%SYS--LOGMSG: Message from 0():


That feature have only been ported to those platforms for now. You can always request an enhancement via TAC or the account team.

danailpetrov Thu, 07/09/2009 - 21:22
User Badges:

Yep, it's exactly what I need/mean.Can you provide me with an url address for this "feature" on your (cisco's) website?


Kind regards,

Dani

Correct Answer
Lucien Avramov Fri, 07/10/2009 - 09:16
User Badges:
  • Red, 2250 points or more

There was an enhancement request on this. If you open a TAC case, they will be able to publish this for you so you will have an external document. They can contact lavramov for more information.


danailpetrov Fri, 07/10/2009 - 13:51
User Badges:

Thank you for your effort and cooperation. I really appreciate it. I won't open a TAC case for now but thanks for the idea too.


Kind regards,

Danail Petrov

Joe Clarke Fri, 07/10/2009 - 15:40
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Actually, EEM will not allow you to create custom syslog messages. That feature is coming in EEM 3.1. For now, all EEM syslog messages will always have the %HA_EM facility. The Embedded Syslog Manager will allow you to modify messages as they are generated, but you will need to have a message generated first.


There is another option. You can use the "syslog:" file system to create custom messages using tclsh. Messages will be sent using buginf() (i.e. the same way debugging messages are sent). The attached simple tclsh script will allow you to make use of this feature:


tclsh send_syslog.tcl FACILITY SEVERITY MNEMONIC BODY


For example:


tclsh flash:/send_syslog.tcl MARCUS 1 XXX "This is a test"



Attachment: 
danailpetrov Sat, 07/11/2009 - 09:31
User Badges:

Thank you so much for this hint. I didn't knew that TCL has such function (buginf()).


Best regards,

Danail Petrov

Actions

This Discussion