Community discussions

 
User avatar
martini
Member Candidate
Member Candidate
Topic Author
Posts: 296
Joined: Tue Dec 21, 2004 12:13 am

Script to read log

Fri Apr 16, 2010 10:09 am

Need some simple scrip to read log on ROS and print warning (IP address in log string ) if in log appers "user logged in, 10.1.1.1"

Script in wiki not working.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5942
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Script to read log

Fri Apr 16, 2010 10:24 am

Here is an example how to read log entries:
http://wiki.mikrotik.com/wiki/Manual:Sc ... _log_entry

Adapt the script for your needs.
 
User avatar
martini
Member Candidate
Member Candidate
Topic Author
Posts: 296
Joined: Tue Dec 21, 2004 12:13 am

Re: Script to read log

Fri Apr 16, 2010 5:31 pm

i know this script, this line not working
:global currentTime [:totime [/log get [:pick $currentBuf($currentLineCount - 1)] time]];
RoS version 4.4, 4.5, 4.6, 5.1
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Script to read log

Mon Apr 19, 2010 2:43 pm

if you look carefully, line you are quoting and line that is take from the script actually are not the same
:global currentTime [:totime [/log get [:pick $currentBuf($currentLineCount - 1)] time]];
line from linked script:
:global currentTime [ :totime [/log get [ :pick $currentBuf ($currentLineCount -1) ] time   ] ];
hence, result is not the same.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Script to read log

Tue Apr 20, 2010 3:17 am

Here is your error:
:global currentTime [:totime [/log get [:pick $currentBuf($currentLineCount - 1)] time]];
                                                        ^^^ 
Should be:
:global currentTime [:totime [/log get [:pick $currentBuf ($currentLineCount - 1)] time]];

Who is online

Users browsing this forum: No registered users and 19 guests