• MikroTik.com
  • RouterBOARD
  • User Meeting
  • Training
  • User Manual
  • Support
  • Downloads
  • Videos
Register |   * Login | HOME

View unanswered posts | View active topics

Filter LOG messagens with API  Page 1 of 1
 [ 2 posts ]  Post new topic Reply to topic
  Print view Previous topic | Next topic 
Author Message
alexandrecorrea
 Post subject: Filter LOG messagens with API
PostPosted: Thu Jan 05, 2012 6:48 pm 
Offline
just joined

Joined: Fri Sep 22, 2006 5:18 pm
Posts: 15
Karma: 0

Location: Sacramento, MG, Brasil
Hello, i´m trying to do this:

[admin@Orbit] /log> print where message~"failed"
14:35:04 pppoe,ppp,info <pppoe-0>: terminating... - user ajcorrea authentication failed
14:35:35 pppoe,ppp,info <pppoe-0>: terminating... - user ajcorrea authentication failed
14:36:06 pppoe,ppp,info <pppoe-0>: terminating... - user ajcorrea authentication failed
14:36:37 pppoe,ppp,info <pppoe-0>: terminating... - user ajcorrea authentication failed

with API:

Code:
<?php

require('/ondasys/phplibs/mikrotikapi.class.php');
$API = new routeros_api();

$API->debug = true;

if ($API->connect('xxxx', 'xxx', 'xxx')) {

   $ARRAY = $API->comm('/log/print',array("~message"=>"authentication failed"));
   print_r($ARRAY);
   $API->disconnect();

}
?>


but api returns ALL log entries ...

... filtering logs are possible with API ?!

thanks !!!!


Top
 Profile  
 
boen_robot
 Post subject: Re: Filter LOG messagens with API
PostPosted: Thu Jan 05, 2012 7:41 pm 
Offline
Long time Member
Long time Member
User avatar

Joined: Thu Aug 31, 2006 3:43 pm
Posts: 562
Karma: 79

Location: europe://Bulgaria/Plovdiv
Regex are not officially supported with API. The current implementation in Denis' class is a hack, and by virtue of being a hack, it only works for some lists in some RouterOS versions.

See this topic for details.

_________________
PEAR2_Net_RouterOS(1.0.0b3) - My API client in PHP


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 2 posts ] 

Board index » RouterOS » Scripting

All times are UTC + 2 hours


Who is online

Users browsing this forum: galaxynet and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Karma functions powered by Karma MOD © 2007, 2009 m157y