This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Pushover/email error log
#5
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)
Reply


Messages In This Thread
Pushover/email error log - by PassivPluss - 01.10.2022, 17:43
RE: Pushover/email error log - by PassivPluss - 10.10.2022, 11:35
RE: Pushover/email error log - by admin - 10.10.2022, 11:35
RE: Pushover/email error log - by PassivPluss - 10.10.2022, 12:19
RE: Pushover/email error log - by admin - 11.10.2022, 10:26
RE: Pushover/email error log - by PassivPluss - 13.10.2022, 07:11

Forum Jump: