Log Viewer plugin

A Log Viewer plugin to try out - it displays the log file in your web browser. This plugin has three main advantages:

Ver 0.51

[ul][li]It has a PAUSE button[/li]
[li]No need to SSH into Vera[/li]
[li]You can specify a ‘Lua pattern’ to narrow down the log entries to those of interest.[/li][/ul]

This plugin has been tested using the Vera U15 interface and Firefox 17.0.1 only.

Installation for U15:
Go to U15–>APPS–>Develop Apps–>Luup files and upload the five files.
Select the “Create device” button on the same page. Enter ‘D_LogViewer1.xml’ into the ‘Upnp Device Filename’ entry box and select the ‘Create device’ button immediately below.

Notes:
You access the log file web page by clicking on the link that can be found on the Log Viewer device’s ‘Set Pattern’ tab. You also enter a ‘Lua pattern’ to filter the log file. Examples of patterns can be found here:

http://www.qscaudio.com/products/software/QSys/WebHelp/Content/Control%20Scripting/The%20Lua%20Language.htm#Patterns

To remove all filtering just leave the pattern entry box blank and hit the ‘Update’ button.

The pattern can be updated in the U15 page while the Log Viewer page is running - it will change to reflect the new pattern.

You can Pause/Continue by clicking on the light bulb icon on the web page and then scroll back and forth as needed.

The page is set to go back 1000 lines when it first opens. So if you want to check a Vera startup process, just click on the link, once Vera has finished starting up. If you click on the link too early ie prior to start up completion, you will get a ‘500 - Internal Server Error’ or a ‘No handler’ error.

The lines will just keep piling up in the web page. I have no idea how many lines can be shown on the page before the browser blows up but I’ve had it running with no filter for over a day.

Log file rotates done by Vera are automatically accommodated.

The log file is expected to be at it’s default location ie /var/log/cmh/

The log file web page will not be visible outside you local LAN.

Due to a bug in the Vera UI 15 - patterns entered must be URL encoded - so if you need a % symbol write %25 instead.

Due to a bug in the Vera log file generator, the log file contains escape characters and characters above 7Fh. As the log file is sent to the browser as UTF8 encoded XML, I have had to replace them with ASCII characters.

All control characters are shown as ‘ctrl_chr’ and characters above 7Fh are displayed as ‘intl_chr’. My apologies to non English speakers but I can’t see a better way to handle these characters in this case.

Will be interested to hear if this plugin works OK but I have no immediate plans to do any more work on it.


Ver 0.52
This gives more definitive error messages, rather than the “XML is malformed” message.
For those who have installed ver 0.51, you will also benefit from some other minor improvements. When the Lua filter pattern is changed; this now gets marked on the output like so:
****** Lua pattern changed to: Ping ******
It also goes back to the start of the log file to find all entries rather than starting at the current location.


Ver 0.53
Turned off the debug mode


Ver 0.54
Hardened pattern input and caught a few edge cases. A few more messages are now output to the user. It’s recommended to update to this version.


Ver 0.55
Fixed a regression
If you have any previous version installed already, you only need to update the file ‘L_LogViewer1.lua’ The version number can be seen on line 11.


Ver 0.56
Fixed a problem where the Lua pattern wasn’t handled properly between engine restarts
If you have any previous version already installed, you only need to update the file ‘L_LogViewer1.lua’ The version number can be seen on line 11.

Log Viewer no longer supported. Please use Info Viewer instead:
http://forum.micasaverde.com/index.php/topic,13477.0.html

Great idea, will check it tonight!

It works perfectly on my vera3.
I haven’t tested pattern feature.

Super @a-lurker. Will also check it out.

Great stuff - I’ll check this out. I was planning on doing something within dataMine to dump the DM entries, but this is a much better idea :slight_smile:

Cheers
Chris

I installed it like you told, but, this it what i get

XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed
XML is malformed

Now i have a device that is not working and i can’t remove it ?

For me it work on the first try! Very very great tool. I it is very usefull to see the log of vera’s on which I don’t have ssh access. THANK YOU!

Why don’t you release it on apps.mios.com?

@rpleever

Yes - I didn’t explain this properly. Basically if the Vera server cannot return log file info - while Vera is busy restarting for example - it will return ‘500 - Internal Server Error’ or a ‘No handler’ errors. These are caught and displayed as “XML is malformed”. If you see this on any other occasions, use the Web console in your browser to see what Vera is actually returning and let us know.

Note that users that have a log running somewhere else besides ‘/var/log/cmh/’ will probably RX errors. You can change the file location and name in L_LogViewer1.lua on about line 33.

works, great!

I am also getting the “XML is Malformed” error.

I am doing it from work so my guess is the info isn’t transferring through the forwarding servers (similar to DataMine). I’ll try from home this evening and see if that clears up the issue.

@rpleever and @Trotsky40

Please try version 0.52 now attached above. You only need to update the file ‘L_LogViewer1.lua’. It won’t eliminate the messages but will give a better indication of what the problem is.

Nice plug in there man. This looks very useful.

Being a newbi to LUA, I am not sure about the filtering function scripts. Could you show some examples where one could just list various things? For example, list only datamine activity, or device activity, or LUA errors, or Lua configs such as USB use?

Sorry to ask, but with some realtime examples, I can possibly figure out better.

Thanks again…

This would be best asked in a thread for the appropriate plugin.
This is plugin specific information.

[quote=“a-lurker, post:11, topic:173945”]@rpleever and @Trotsky40

Please try version 0.52 now attached above. You only need to update the file ‘L_LogViewer1.lua’. It won’t eliminate the messages but will give a better indication of what the problem is.[/quote]

It is definitely a local versus remote access issue. Now that I am home, I can replicate the issue on my iPad using Chrome. Using local wifi, the plug-in works perfectly. Turning off wifi and using LTE cellular instead, I get the “XML is Malformed” error message.

[quote=“Trotsky40, post:14, topic:173945”][quote=“a-lurker, post:11, topic:173945”]@rpleever and @Trotsky40

Please try version 0.52 now attached above. You only need to update the file ‘L_LogViewer1.lua’. It won’t eliminate the messages but will give a better indication of what the problem is.[/quote]

It is definitely a local versus remote access issue. Now that I am home, I can replicate the issue on my iPad using Chrome. Using local wifi, the plug-in works perfectly. Turning off wifi and using LTE cellular instead, I get the “XML is Malformed” error message.[/quote]

I just updated to the newest version (0.53), now the remote access error reads:

Log viewer ajax error - server status is: 200

Patterns - important point. Since Vera’s U15 interface doesn’t URL encode characters sent back to Vera you need to manually do it so. When the letter percent is used it must be replaced with %25. Here’s some info on what chars need to be encoded. This appears to be another Vera bug :-.

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

You can try these examples - all case sensitive:

dataMine datamine activity
device: 15 device number 15 activity
^[0][1] Error - error level 1
%25b[] Anything in square brackets - note that %25 is a URL encoded %
LEAK Info re: memory management
luup_log:51 log for device 51
usb usb related
got CAN got a Z Wave CAN character
root some (not all) start up stuff
dataMine: Mounted dataMine mounted a USB stick

@Trotsky40

The program uses port 3480 (as required by Vera), which is probably not going to get through your local firewall.

Plugins dependent on local access of files will not function outside of your network even via MCV’s proxy. For example this plugin and also datamine. It would require opening up ports on your firewall to function correctly (not recommended).

  • Garrett

Same thing here

Log Viewer ajax error - server status is: 200Log Viewer ajax error - server status is: 200

@ a-lurker

Thanks for the examples. I played around with some already.

02 2013-01-13 12:23:52 - LuaUPnP boot This is the first line of my log. Notice the date and time. It never changes. I ran this on Jan 15th 6:10 pm. Any idea whay the time/date would be off?

I do have 2 USB sticks in my Vera 3. 1 is for Vera logging and one for datamine. Is the viewer only reading bu logs vera generates which may explain the date stamps. Shouldn’t your plugin be reading the realtime events?

Cheers