I am new to the community and really enjoy setting up Home Assistant. I have a question related to the recorder. My log file is growing and growing and when it grows to 2-3 Gb Home Assistant is struggling and becomes unstable. I am using the the default SQLite database. I do not need all the history so I am fine with purging the log database.
In my configuration.yaml file I have added:
recorder:
purge_days: 1
So far all well and Home Assistant starts up and no complaints about the recorder in the log file. However the log file does not get purged. My solution now is to delete the database file manually, but I would rather like to use the Purge function.
The permissions for the db log file is rwrwrw. Owner is homeassistant user.
Anyone experienced similar issue and managed to fix it?
Since I am new to Home Assistant I do some changes everyday and then restart Home assistant. I do understand why you asked the question. I do not know when or how often the recorder will purge the data. I assume it is only once a day, but when? Someone knows?
At the time, you started HA, e.g. you (re)started HA at 5:00 pm, then after 2 days the purge will beginn at 5 pm. If you let HA continuously running, then the purge will be running every day at 5 pm.
That´s because of an other sort of getting the size. I tried the last hour to get the correct size and this is the result:
mysql -u USER -pPASSWORD -s -N -e 'SELECT SUM( data_length + index_length)/1024/1024 FROM information_schema.TABLES where table_schema = \"hass_db\";'
You have to replace the PASSWORD and the USER, of course. This command opens mysql and execute the query to get the size of the databases. Now i will upgrade to 0.44
I had massive problems with MySQL 5.7 on Debian Stretch, after a bit of tweaking I can get a value to output correctly in a terminal but it won’t transfer into HA for some reason…
Suppress the warnings about command line execution, note not to actually put your password in as it will prompt you for it…
mysql_config_editor set --login-path=local --host=localhost --user=username --password
Then you can trigger the statement like this…
mysql --login-path=local -s -N -e 'SELECT SUM( data_length + index_length)/1024/1024 FROM information_schema.TABLES where table_schema = "hass_db";'
This returns a number in the command line but it shows as “unknown” ins HA - this was because I had to set up the mysql config under the homeassistant account, after that everything was fine.