LogicMachine Forum
Export Access Logs - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Export Access Logs (/showthread.php?tid=3835)



Export Access Logs - anagno@bluewin.ch - 30.01.2022

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


RE: Export Access Logs - admin - 31.01.2022

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')



RE: Export Access Logs - anagno@bluewin.ch - 31.01.2022

excellent! thank you very-very much