Community discussions

MikroTik App
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Command to write lost internet connection to log?

Sun Aug 12, 2007 3:33 pm

Hi!
Could you give me some command to write lost internet connection to log?
I was trying it over script, the script pinged the host for 5 times(the host was unreachable), but it did not write to log.
How to put something to script to write to log?
 
User avatar
Giepie
Member
Member
Posts: 433
Joined: Mon Sep 13, 2004 12:33 pm
Location: Western Cape, South Africa
Contact:

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 3:11 am

You generally use the following:

:log info "message goes here"

I find it can only put something in your log once. eg: "Starting Script".

What I do to have log entries, is to call up another script (which is basically the script doing the actual work), and in it's first line put:

:log info "this event is now happening"

Hope this helps
 
User avatar
Letni
Member
Member
Posts: 376
Joined: Tue Dec 05, 2006 5:16 am
Location: South Carolina

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 3:29 am

Change the Host to the gateway or any other IP on the internet.

/ tool netwatch add host=a.b.c.d timeout=1s interval=1m up-script=":log info \"Internet Up\"" down-script=":log info \"Internet Down\"" comment="" disabled=no

-Louis
 
User avatar
Giepie
Member
Member
Posts: 433
Joined: Mon Sep 13, 2004 12:33 pm
Location: Western Cape, South Africa
Contact:

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 3:36 am

Off course, NETWATCH is by far a better way to go...
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 11:25 am

ok, thanks it works using netwatch(it writes message to log). Is it possible to write log to some txt file on hard disk(in routerboard) to be stored there, after rebooting?

I read routeros manual system logging, but hard to understand that(little examples of using).
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 12:01 pm

info, script set to log to harddrive in /system logging
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 1:59 pm

ok, and where I find that txt file with the informations from log file saved to disk, I was looking in files(mikrotik) and there is no log txt file.
 
cmit
Forum Guru
Forum Guru
Posts: 1547
Joined: Fri May 28, 2004 12:49 pm
Location: Germany

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 2:07 pm

It's written to the regular system log. But entries which are written to "disk" will survive a reboot.
So a "/log print" will show those entries, too...

Best regards,
Christian Meis
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 3:44 pm

when you use /log print you can set what to print (memory, disk)
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: Command to write lost internet connection to log?

Mon Aug 13, 2007 5:07 pm

OK Thank you very much, everythings fine now