DB usage by Device Event Logs and ability to Clear Events?

When I started with HE I set up the Device Event and Status numbers above the default settings (100 with most of my devices) hoping that it would help me with trouble shooting any problems in the future I might have with events associated with these devices.

I have just started to monitor and graph my DB size and Free Memory Size with Hub Information Driver and this peeked my curiosity as to how much of an impact the size of these logs have on my DB usage and Free Memory size. My DB usage drops to around 25MB immediately following a reboot, then jumps to around 45-55MB over the next couple of days. Also, my Free Memory jumps to around 500k right after a reboot then gradually drops to around 315k over the next few days. I set up a Rule to reboot when Free memory goes below 300k at this time to pre-empt any potential Hub slowing.

Prior to using LTS with Hubigraph, in order to be able to graph over a 7 day period I had set the Hub Information virtual device to 2000 events and states, so my Device event log has ballooned to over 5000 entries. I have since starting using LTS as the data source for my graphs and so have been able to reduce my Hub Information virtual device to around 200 events, but the existing logs remain.

1). I am wondering what the impact these large event logs have on my DB usage and available free memory, and
2). If there is a significant impact, is there a way to clear these event logs without having to delete each device then re-create each device and re-enter into each Rule, etc. I found that even with a reboot the logs do not reset, so older devices keep growing over time.

Thanks for any help. (If there is no other current way to clear these logs, I would like to suggest this as a requested feature).

It has a direct impact on DB usage. When a lot of events are saved, the DB usage will go up. I suspect it might also impact free memory, but not sure…

You just need to reduce the Event history and State history sizes. I keep mine pretty low - I have a lot of devices, so find that this works much better for me.

image

Thank you @Sebastien,
IIRC, in researching how to clear the device events log, I read something about not being able to clear the logs without actually deleting the device. I am currently on v2.3.0.124. Does resetting the device log limits settings, then restarting now automatically clear the DB in more recent software? Thanks again!

As I understand it, the logs are not the problem. Reducing the history size will do it. There is an automated process that will then clear out the extras.

Should clean up on it’s own but there is an endpoint

http://your.hubs.ip.here/hub/cleanupDatabase

that may clean up hanging records. A soft reset is probably a better recourse if you’re worried, but I haven’t seen an issue reported for several releases now. Quick way of seeing how many of an event or state you have:

https://raw.githubusercontent.com/thebearmay/hubitat/main/apps/eventStateDisplay.groovy

1 Like

@thebearmay, Thanks for the info. Does the http cleanupdb site also clear out the files kept in file manager? I do not wish to lose the data held in file manager. TIA for any info.

Doesn’t touch the file manager space.