Logic Machine Forum
Logs in visualization - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Logs in visualization (/showthread.php?tid=728)



Logs in visualization - Bitver - 09.04.2017

Hi,

How is it possible to make a page with raw list of 30 day log of certain objects?

e.g. I need to log 20 binary inputs (1bit objects) and show them somehow.

Thanks.


RE: Logs in visualization - buuuudzik - 10.04.2017

(09.04.2017, 16:49)Bitver Wrote: Hi,

How is it possible to make a page with raw list of 30 day log of certain objects?

e.g. I need to log 20 binary inputs (1bit objects) and show them somehow.

Thanks.

Here you have a lua script for getting from db logs from last 30 days only for specified objects:
Code:
objects = "Object name 1', 'Object name 2" -- comma separated names of objects

query = "SELECT objectlog.id, objectlog.datahex, src, logtime  FROM objects, objectlog WHERE objectlog.address=objects.id
AND name IN('" .. objects .. "') AND logtime>=" .. os.microtime()-30*24*3600 .. " LIMIT 30"

logs = db:getall(query)

The result is a table with such data:
- objectlog.id - id in objectlogs
- objectlog.datahex - data in datahex("01" for true and "00" for false for binary)
- src - sender address also in hex
- logtime - timestamp of log

This data you can:
1) write to some object only for visualisation purposes via grp.update() with filter if necessary
or
2) or you can write a simple .lp file with mixed HTML + Lua which generate divs with above data. Then you can add this simple site to your visualisation.

Type ".lp file" in search input on this forum to see some information about this function.

For start you can check this post:
http://forum.logicmachine.net/showthread.php?tid=85


RE: Logs in visualization - Bitver - 03.05.2017

Thanks a lot. It's difficult to find and understand how to do this but now I see.


RE: Logs in visualization - toujour - 19.02.2019

How can I use the objects in the grp.update ?

For example with a 14byte ASCII string with the value of the object.id + objectlog.ASCII + logtime

grp.update ('32/2/2', 'Event: ' .. object.id .. objectlog.ASCII .. logtime )


RE: Logs in visualization - admin - 19.02.2019

What kind of task do you have? If you display only one log entry you will get the same result as showing current object value.