We have moved at community.getvera.com

Author Topic: GetLog Plugin for UI5 and UI7 R1.2  (Read 6869 times)

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
GetLog Plugin for UI5 and UI7 R1.2
« on: March 07, 2016, 06:40:08 pm »
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://<your vera ip>: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.






« Last Edit: June 03, 2017, 04:22:56 am by Stuart »

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: GetLog Plugin
« Reply #1 on: March 08, 2016, 12:20:35 am »
Thanks Stuart. I will give this a try.
- Tomas

Offline aste

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: GetLog Plugin
« Reply #2 on: March 09, 2016, 06:31:05 am »
Thanks! Great to have it saved to a file directly.

Previously I used this to get the logs:

http://<vera IP>/cgi-bin/cmh/log.sh?Device=LuaUPnP

\\ Andreas

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: GetLog Plugin
« Reply #3 on: March 09, 2016, 06:32:55 am »
@aste

your previous solution only works localy
- Tomas

Offline amg0

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: GetLog Plugin
« Reply #4 on: March 13, 2016, 05:18:32 am »
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

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GetLog Plugin for UI5 and UI7
« Reply #5 on: March 13, 2016, 05:44:18 pm »
@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.
« Last Edit: March 13, 2016, 05:49:34 pm by Stuart »

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: GetLog Plugin for UI5 and UI7
« Reply #6 on: March 14, 2016, 08:45:11 am »
@Stuart GetLog plugin works fine for me on my VeraPlus

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

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GetLog Plugin for UI5 and UI7
« Reply #7 on: March 24, 2016, 11:49:32 pm »
Production version posted -- see first post for details.

Offline adma

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: GetLog Plugin for UI5 and UI7
« Reply #8 on: May 27, 2016, 09:41:38 am »
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.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GetLog Plugin for UI5 and UI7
« Reply #9 on: May 27, 2016, 11:52:42 am »
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/

Offline amg0

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: GetLog Plugin for UI5 and UI7
« Reply #10 on: May 27, 2016, 12:01:12 pm »
@Stuart GetLog plugin works fine for me on my VeraPlus

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

:-),  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 )

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GetLog Plugin for UI5 and UI7
« Reply #11 on: May 27, 2016, 01:23:08 pm »
@ amigO.   I will - promise  -- just need to fit it all in with my day job .....

Offline kevink619

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +0/-4
Re: GetLog Plugin
« Reply #12 on: August 26, 2016, 06:02:50 pm »
Thanks! Great to have it saved to a file directly.

Previously I used this to get the logs:

http://<vera IP>/cgi-bin/cmh/log.sh?Device=LuaUPnP

\\ Andreas

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.

Offline Stuart

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
  • Karma: +71/-2
Re: GetLog Plugin for UI5 and UI7
« Reply #13 on: September 01, 2016, 06:24:10 pm »
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.

Offline kevink619

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +0/-4
Re: GetLog Plugin for UI5 and UI7
« Reply #14 on: September 07, 2016, 02:28:06 pm »
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

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.