2016-07-12 11:09 AM
Hello,
I'm trying to process time with LUA parser. I'm not able to set callback for meta with the type "TimeT" (nwtypes.TimeT).
If my code look like :
[nwlanguagekey.create("time", nwtypes.TimeT)] = compare_times.getTime,
I get this error :
NwLogDecoder[17686]: [Parse] [failure] Meta processing failed for session with: Bad cast
From my undestanding TimeT is an 8 bytes type, I've tried to use Unint8 unstead but callback does not work.
Thanks in advance for you advice.
Claude
2016-07-13 05:16 AM
Hi Claude,
The time meta format is TimeT so your declaration should be correct. Depending on the parser logic, you may try to only register the time meta without running the getTime function and see if the time meta is registered correctly. You can enable detailed stats from Decoder Explore -> parsers -> config -> detailed.stats=yes and this will show all the metas each parser registered in the stats. This change should be done for debugging only because it is expensive in processing.
Best regards,
Abdelrahman
2016-07-13 05:37 AM
Hello Abdelrahman,
thanks a lot for you answser and the debuggin tips.
What do you mean by "only register withour running getTime function" ?
I 've tried with empty function, it look like the function doese not take the right argument type. It register correctly if I override the type by forcing Unint8 but the callback doese not work.
I have tested the details stats. In my LUA parser I register 2 meta for Callback. And in stats there is 2 meta shown as callback so it seems correct.
Many thanks in advance.
Claude
2016-07-13 09:15 AM
Hi Claude,
As far as I know the bad cast error is happening because internally TimeT is a 64 bit integer while the lua engine currently in use only supports 32 bit integer, hence the error. My understaning (but I'd be happy to be wrong) is that until the lua engine will be upgraded, you cannot really deal with TimeT meta keys.
Thanks
2016-07-13 09:49 AM
Hello Davide,
Thanks for your answer ! My lua seems to be compiled as 64 bit.
file /usr/bin/lua
/usr/bin/lua: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
Maybe I can somhow cast it to Unint64 , what do you think ?
Thanks in advance.
Regards.
Claude
2016-07-13 09:59 AM
Lua as used by the parsing engine is compiled into the parsing engine (LuaJIT, specifically). It doesn't use the lua executable at /usr/bin/lua. LuaJIT itself is based on Lua 5.1.
There's really no way to work with a TimeT in a lua parser.
2016-07-13 10:07 AM
Thanks William,too bad...
so i'll search for another way to achieve this.
Do you now if time comparison is supported by apprule ?
I want to compare metas : time and event_time ( getter than or lower than).
Thanks in advance.
Claude
2016-07-21 03:53 AM
Hello,
what do you think about mapping event_time and time to a new metas with uint64 type (Transiente one) and use it in the LUA parser ?
Thanks in advance
2016-07-21 06:43 AM
I don't think that would help. It would still be a 64 bit int, and LuaJIT is going to normalize it to 32 bits.
2016-07-21 06:44 AM
Unfortunately you can't compare two meta values to each other in an app rule.