log entry and action when occurs

Something like:
http://forum.mikrotik.com/t/parsing-log-file-to-get-ip/149094/1
might be of inspiration, but I believe the issue is that you must clear the log (setting its lines to 1 and then back to the “normal” number of lines, like in this (old) script):
https://web.archive.org/web/20210416175553/https://wiki.mikrotik.com/wiki/Log_Parser_-_Event_Trigger_Script
every time, and this might be inconvenient/not wanted.