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.

Export Access Logs
#1
I would like to export the Wiser's Access Logs. Is this possible?

Attached Files Thumbnail(s)
   
Reply
#2
Use this to export to CSV. Then you can upload it to FTP, send via e-mail etc.
Code:
rows = {
  '"date","login","ip","failed"'
}

items = db:getall('SELECT * FROM user_logs ORDER BY id DESC')
for _, item in ipairs(items) do
  date = os.date('%Y.%m.%d %H:%M:%S', item.created)
  failed = toboolean(item.failed)

  rows[ #rows + 1 ] = string.format('%q,%q,%q,%q',
    date,
    item.login or '?',
    item.ip or '?',
    failed and 'yes' or 'no'
  )
end

csv = table.concat(rows, '\n')
Reply
#3
excellent! thank you very-very much
Reply


Forum Jump: