11.10.2022, 10:26
Run this as a scheduled scripts that runs once every minute. Replace log call with email/pushover etc.
Code:
stmaxid = storage.get('errorsmaxid', 0)
dbmaxid = db:getone('SELECT MAX(id) FROM errors') or 0
if stmaxid == dbmaxid then
return
elseif dbmaxid < stmaxid then
stmaxid = 0
end
rows = db:getall('SELECT * FROM errors WHERE id>?', stmaxid)
for _, row in ipairs(rows) do
stmaxid = math.max(stmaxid, row.id)
errordate = os.date('%c', row.errortime)
log(errordate, row.scriptname, row.errortext)
end
storage.set('errorsmaxid', stmaxid)