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
#1
Hi
Is it possible to email/pushover error log whenever a new error logĀ  entry comes?
Reply
#2
Is it possible?
Reply
#3
What kind of errors do you want to catch? Errors from scripts?
Reply
#4
if error log gets a new entry, so I was thinking all new entries.
Reply
#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
#6
Works perfect as alwaysSmile Thanks admin
Reply


Forum Jump: