mikrotik log code example
Example: mikrotik address list log into file
{
:local listName "Server";
:local fileName "exported.rsc";
:local buffer;
:global filteredList [/ip firewall address-list print as-value where list=$listName && dynamic=no];
:foreach i in=$filteredList do={
:set $buffer ($buffer."add list=".$listName." address=".$i->"address"."; ");
};
/file print file=$fileName where name="";
:delay 1s;
:set $buffer ("/ip firewall address-list; ".$buffer);
/file set $fileName contents=$buffer;
}