[j-nsp] Is that possible to add a custom message in the log file?

Chris Grundemann cgrundemann at gmail.com
Fri Apr 17 01:55:28 EDT 2009


On Thu, Apr 16, 2009 at 21:26, wang yi <wang.yi.2009 at googlemail.com> wrote:
>
> Just wondering if it is possible to add custom log messages to the log file
> so that I can have something like:
>
> Apr 15 01:30:00 [case1234] PIC for so-0/0/0 replaced, keep an keen eye on
> it.
>
> when the duty engineer do a "show log messages | match case1234" knows when
> and what FRU's have been replaced.


It sounds like you want to know how to send a single custom message to
log messages, not set up persistent custom logging; if that is the
case, one option is to drop to the shell and just append your message:

cgrundemann at ar51.den1> start shell
% echo "TEST MESSAGE" >> /var/log/messages
% exit
exit

cgrundemann at ar51.den1> show log messages | find "Apr 17 05:32:48"
Apr 17 05:32:48  ar51.den1 sshd[89448]: %AUTH-6: Accepted password for
cgrundemann from xxx.xxx.xxx.xxx port 34055 ssh2
TEST MESSAGE

cgrundemann at ar51.den1>

As you can see, this message would be added exactly as you input it,
no time stamp is added.  You could add a time stamp yourself or just
let the messages before and after qualify when it was added.

Another thing to note, this message will only be stored in the local
/var/log/messages file (aka the messages log) it will not be sent to
any syslog server.  This could be good or bad, depending on your
situation - it sounds like you were looking for a local message
though.



If you are running newer code and want something more automatic; this
may help: http://forums.juniper.net/jnet/board/message?board.id=JUNOS&message.id=1187.
 If you just want your manual message to get a time stamp and be sent
to your syslog server; op scripts can be called from the cli, so once
it is written you can trigger it manually:

cgrundemann at ar51.den1> op ?
Possible completions:
  <script>             Name of script to run
cgrundemann at ar51.den1> op



Hope that helps,
~Chris

>
>
> thanks.
>
> yi
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp



--
Chris Grundemann
weblog.chrisgrundemann.com


More information about the juniper-nsp mailing list