GetLog Plugin for UI5 and UI7 R1.2

In order to assist with getting log files remotely from vera, I put together this simple plugin. It takes a copy of the logfile (and optionally applies a grep pattern) and places it in the /etc/cmh-ludl folder. You can then directly download the logfile. Hopefully it will be useful – feedback welcome.

You can install the latest version of the plugin from the marketplace or directly from the link below.

http://:3480/data_request?id=update_plugin&Plugin=7626

When you press the “Get Log” button (either from the front panel or the control tab) a copy of the log file will be created. It will be modified by any grep pattern you set (from the control tab). The log file will be named 00-GetLog.log. This may take up to a minute or so depending on the size of the log file.

Once the log file is created – go to Apps --> Develop Apps --> Luup files and you will see the log file listed near the top. “Download” it (“View” does not work) and view it with a good text editor. I use Notepad++.

Release 1.2
Fixed a bug that caused grep errors and made V1.1 unusable in certain situations.

Release 1.1 (Withdrawn)
Added a “Clear Logs” button - this will remove logs for GCal3 as well as the log file for GetLogs.

Thanks Stuart. I will give this a try.

Thanks! Great to have it saved to a file directly.

Previously I used this to get the logs:

http:///cgi-bin/cmh/log.sh?Device=LuaUPnP

\ Andreas

@aste

your previous solution only works localy

for information, it is one of the feature ALTUI plugin offers this out of the box
ALTUI plugin discussions: http://forum.micasaverde.com/index.php/board,78.0.html

@amg0 – good to know – looks classy. I’m finishing up some upgrades to GCal3 and likely that will remain stable for a while. I’ll then give ALTUI a look.

@Stuart GetLog plugin works fine for me on my VeraPlus

@amg0 stil have not found time to look in to AltUI, sorry about that :-\

Production version posted – see first post for details.

It would be nice to have some grep examples on the plugin device page to help users (like myself) that aren’t familiar with grep and aren’t familiar with the logging syntax in general. For example, how to filter by device ID, or command name, or view the last X lines of the log, etc.

Thanks.

The easiest way is to get a log file without any filter and take a look.
grep is well explained on the web - so play around with it and see what suits you.

As an example - if you put “device: 50” (with the quotes) into the filter you will get all lines with that string as the output.

The actual command being executed is this:

grep “device: 50” /var/log/cmh/LuaUPnP.log > /etc/cmh-ludl/00-GetLog.log

Whatever you put in the filter end up going in here grep [filter] /var/log …

Here is an example of how to use grep:

http://www.thegeekstuff.com/2009/03/15-practical-unix-grep-command-examples/

[quote=“korttoma, post:7, topic:191478”]@Stuart GetLog plugin works fine for me on my VeraPlus

@amg0 stil have not found time to look in to AltUI, sorry about that :-[/quote]

:-), you should… ( selling my own soup here ). more seriously, it makes this easy because you see the logs, can enter a string and it will construct the grep string for you, and you can even save your favorite commands under a button , so next time , it is one click only ( even if you have a parameter that you want to change for that command )

@ amigO. I will - promise – just need to fit it all in with my day job …

[quote=“aste, post:3, topic:191478”]Thanks! Great to have it saved to a file directly.

Previously I used this to get the logs:

http:///cgi-bin/cmh/log.sh?Device=LuaUPnP

\ Andreas[/quote]

Thanks. This actually works. The plug-in seems to be incompatible with the latest firmware on my VeraLite. I keep getting a grep 512 error with the plugin, but your URL method works like a charm.

I’m on V 1.7.2139.

It is possible, depending on how much is installed on your vera, to run out of file space and that can throw an error. Are you using a usb drive for the log files ? Do you have verbose logging turned on ?

I had a similar problem a few days ago - so I turned on USB logging and also made some small changes to GetLog so that it will use the log file directory (and hence USB) to generates any temporary file (which can he large). Previously it created a temp file in the vera upload directory …

Try this version of GetLog and let me know if it helps.

Hi,

The version in the app store fails regardless of whether I enable USB logging or not.

The version attached to your message has the same problem:

Grep Pattern: Configured UI7 file
Grep Error Code: 512

Thanks,

Kevin

[quote=“Stuart, post:14, topic:191478”]I’m on V 1.7.2139.

It is possible, depending on how much is installed on your vera, to run out of file space and that can throw an error. Are you using a usb drive for the log files ? Do you have verbose logging turned on ?

I had a similar problem a few days ago - so I turned on USB logging and also made some small changes to GetLog so that it will use the log file directory (and hence USB) to generates any temporary file (which can he large). Previously it created a temp file in the vera upload directory …

Try this version of GetLog and let me know if it helps.[/quote]

What are you using as the Grep Pattern ?

The grep call is returning an error (non zero code) that is interpreted by Lua as 512. Either it cannot handle the pattern or there are no results found…
I have not looked but my guess is that vera is using busybox to implement grep and that may be limiting the results.

If there is no pattern (blank) - what happens ? The grep code is not called if the pattern is blank. So it’s not possible (unless I have cleverly disguised bug) to get this error in the version I posted. If you think this is not the case - can you grab and post a copy of the log file where the GetLog plugin is being called.

I finally got it to work. :slight_smile:

Somehow some random characters were getting added to the grep pattern field. I cleared it out and now it works.

Thanks,

Kevin

This release adds the ability to delete the GetLog log file as well as any GCal3 log files. When GCal3 is uninstalled / installed vera will create new device numbers. This can leave old, unneeded log files in the directory.

I can’t get getlog to save a log file, have tried no text for the grep, and a couple of words I thought it should find (log and wave).

In the case of no text a file is created that can’t be viewed or successfully downloaded. In the case of using thone words I get “Grep Error Code: 256”.

A bit of googling suggests this might actually be a count returned by grepfile via grep.

Try this file - I definitely had a bug that was producing the 256 error. As a side note - the codes returned by Lua are not the ones grep returns, so it’s unfortunately not that helpful. There is some translation going on that I have not had time to figure out.

When you try to read the log file you need to use “Download” and open in a text editor. I’ve never had vera do anything much (other than some xml complaint) with “view”. If the log file is large - I have found that it will sometimes appear to be blank if the file is in the process of downloading when you try to open it in an editor. In which case, try “save” and see if it opens once the download is complete.

Edit: I released this as V1.2 in the marketplace and revoked V1.1

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules