Code: Select all
:local lstime ([/system scheduler get value-name=next-run [find name="login"]] - [/system scheduler get value-name=interval [find name="login"]] * 2);
:foreach i in=[/log find message~"user admin logged in from" && time>=$lstime] do={
:log info "admin in"}
I want to make it work in POS 7. Since in the POS 7 log the time is indicated with the date (a different time format), I decided to use [:tonsec]
I rewrote the script this way:
Code: Select all
:local SchedName "check_login"
:local userName "admin"
:local lstime ([:tonsec [/system scheduler get value-name=next-run [find name=$SchedName]]] - [:tonsec [/system scheduler get value-name=interval [find name=$SchedName]]] *2);
:foreach i in=[/log find message~"user $userName logged in from" && [:tonsec time]>=$lstime] do={
:log info "admin in"}