Log Results Are Being Deleted

If I code a custom app or a driver I will use "log.debug 'stuff'". When I look a the log for the app or driver it will display for 5 or 10 minutes and then the log entries start to be deleted. In a short period of time all my log entries are gone! I imagine I have so much logging going on in all my active driver's and app's that the system has run out of memory and start deleting the oldest entries to make room for the new stuff. What can I do about this? It would be nice to have the filter for logging hold up all logging except what I specify... but that is not what happens. Thanks for the help.

Disable all logging in apps and drivers that are behaving properly. Only enable logging while debugging.

My logs go back weeks, only showing errors and warnings. No reason to excessively log everything for things that work properly.

The logs have a fixed size limit. So, if one has every device and app logging all of the time, the log duration will be short. This is why all built-in drivers automatically disable debug logging after 30 minutes.

I find it useful to have logging on all the time so that when a problem indicates itself I can look at the logs... EXCEPT I can't! But it sounds like I do not have the luxury of doing that and the system does not have infinite resources... to bad. I do have helog.bat which uses logsocket'ing to archive ALL logging to my PC. It is just that it is inconvenient to open up excel every time I want to do debugging. I wish we had another filter/switch in which you can specify which apps/drivers to collect log information at anytime within the logging environment. I also use Snagit to capture the logs on my display before they go away but that is getting old. Thanks for your response.

The way I addressed this is with Grafana and InfluxadB.

I have a driver that captures everything that goes to live logging and sends it to InfluxDB.
Then I have a grafana dashboard that then allows really nice filtering to make finding data easy for any activity on the hub.

4 Likes

If I see a problem I'll turn logging on for the relevant app/device until I can reproduce it. 99% of the time everything is working as it should and there's no need for the extra logs.

1 Like

I found your article " Using HE with with InfluxDB, Grafana, with InfluxDB Logger". I will read thru it and see what I can do. It sure looks like this is what I have needed. Thanks

When i see a problem I want the logging that will help me solve it. It seems that the errors that pop up on me are those that are not very repeatable and turning on debug and waiting puts me back into logging LOTS of data in which it starts to disappear. For typical errors your method is great. Please look at the post from mavrrick58 that appears right before yours... I think that might work for me. I appreciate your help

You will want to look at this thread to for specifics on this spacific ask.

The one thing i would suggest is just be aware that everything has a cost and the more you send through this the more cpu will be consumed processing it. I haven't tried to do this under a super heavy logging condition. I tend to turn logging down on most things similar to how some have mentioned.

I also use Grafana to search and view my logs, but I use a MySQL database because I find it much easier to do complex queries in MySQL vs InfluxDB.

I think the load on the hub(s) is fairly low in my case since I'm using Nodered to interact with the database. Nodered listens to the log socket on each hub and sends the logs to the database. I found the basic template for setting it up here on the forum, but I've tweaked it quite a bit. Hubitat > NodeRed > MySQL > Grafana (LONG READ)

If you have two hubs that are interacting through hub mesh, it's really nice to have the logs in an external database like this. When I query the logs I can filter for just one hub or see them both. Having the logs from both hubs in sequence makes troubleshooting much easier when events on one hub are affecting rules on the other hub. I've recently started sending logging info from NodeRed flows that interact with the hubs to the same database so I can see all of those entries inline with the hub logs.

I also at one point started dumping the output from the events socket to a database. I never set up a dashboard to view them, and I'm not sure I've even used the data for anything yet, but better to have it and not need it than to need it and not have it, IMHO.

1 Like