Community discussions

MikroTik App
 
alexandrecorrea
just joined
Topic Author
Posts: 22
Joined: Fri Sep 22, 2006 6:18 pm
Location: Sacramento, MG, Brasil
Contact:

Filter LOG messagens with API

Thu Jan 05, 2012 6:48 pm

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:
<?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 !!!!
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Filter LOG messagens with API

Thu Jan 05, 2012 7:41 pm

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.

Who is online

Users browsing this forum: Mosfet and 49 guests