Does RouterOS have command alias? I’m finding myself typing /log print where topics~“script” a lot so being able to alias it to say (ql) would be lovely.
PS. On a similar subject, anyone help with the syntax for /log print to show just the last 15 mins? Or the last 10 lines of the log?
:put [/log find time>([/system clock get time]-15m)];
This will show you the .id of the log-lines in the last 15 minutes but I am out on the moment to have the lines printed. Maybe someone else can do that or I will do that a later moment.
That easy
I was expecting some kind of DateAdd kind of function.. Thx!
It was not that easy for me because the .id appeared not correct so I had a search and a peek at a other script:
http://forum.mikrotik.com/t/monitor-mikrotik-log-by-telegram/133039/3
My version now is compact and display the field requested it is buffered in array:
:foreach i in=[:toarray [/log find time>([/system clock get time]-15m)]] do={:put [/log get $i message ]};
display only the message
:foreach i in=[:toarray [/log find time>([/system clock get time]-15m)]] do={:put [/log get $i ]};
displays the lot
How did you solve the problem with the .id ?
Update: also filtering on the topics “script”:
:foreach i in=[:toarray [/log find time>([/system clock get time]-15m) && topics~"script"]] do={:put [/log get $i message ]};
Loos pretty simple
going to try it out
thanks
I also want this alias feature.
Seems can’t find anywhere
I have automatic script that will send config to my email.
If I can alias “/system script run wrme” to wrme, it would be better
Hope added in the next release
:global domail do={/system script run wrme} on-error={log warning “Mail could not be send”};
$domail;
To persist aliases between reboots the /system/scheduler can be used. E.g.:
/system/scheduler/add name=alias start-time=startup on-event=":global test1 do={:put \"You have ran \\\$test1 and it works.\"}"
And then after a reboot the “alias” $test1 is “registered”.