From 0e0d0fa21a000a1274ac1850b7a372344b0ac16b Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Sat, 4 Apr 2020 18:57:17 +0200 Subject: [PATCH 1/4] Introduce recorder auto_purge, remove purge_interval --- source/_integrations/recorder.markdown | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/_integrations/recorder.markdown b/source/_integrations/recorder.markdown index 11e39f16ada0..50111d758e59 100644 --- a/source/_integrations/recorder.markdown +++ b/source/_integrations/recorder.markdown @@ -47,16 +47,16 @@ recorder: required: false default: 3 type: integer + auto_purge: + description: Automatically purge the database every night. This keeps it from growing indefinitely. If you disable this, you can still use the service [`recorder.purge`](#service-purge) when required. + required: false + default: true + type: boolean purge_keep_days: description: Specify the number of history days to keep in recorder database after a purge. required: false default: 10 type: integer - purge_interval: - description: How often (in days) the purge task runs. If a scheduled purge is missed (e.g., if Home Assistant was not running), the schedule will resume soon after Home Assistant restarts. You can use the [service](#service-purge) call `purge` when required without impacting the purge schedule. If this is set to `0` (zero), automatic purging is disabled. - required: false - default: 1 - type: integer commit_interval: description: How often (in seconds) the events and state changes are committed to the database. The default of `1` allows events to be committed almost right away without trashing the disk when an event storm happens. Increasing this will reduce disk I/O and may prolong disk (SD card) lifetime with the trade-off being that the logbook and history will lag. If this is set to `0` (zero), commit are made as soon as possible after an event is processed. required: false @@ -94,7 +94,7 @@ recorder: type: list {% endconfiguration %} -Defining domains and entities to `exclude` (aka. blacklist) is convenient when you are basically happy with the information recorded, but just want to remove some entities or domains. Usually, these are entities/domains that do not change or rarely change (like `updater` or `automation`). +Defining domains and entities to `exclude` (i.e. blacklist) is convenient when you are basically happy with the information recorded, but just want to remove some entities or domains. ```yaml # Example configuration.yaml entry with exclude @@ -113,7 +113,7 @@ recorder: - call_service # Don't record service calls ``` -define domains and entities to record by using the `include` configuration (aka. whitelist) is convenient if you have a lot of entities in your system and your `exclude` lists possibly get very large, so it might be better just to define the entities or domains to record. +Defining domains and entities to record by using the `include` configuration (i.e. whitelist) is convenient if you have a lot of entities in your system and your `exclude` lists possibly get very large, so it might be better just to define the entities or domains to record. ```yaml # Example configuration.yaml entry with include @@ -147,10 +147,10 @@ If you only want to hide events from your history, take a look at the [`history` Call the service `recorder.purge` to start a purge task which deletes events and states older than x days, according to `keep_days` service data. -| Service data attribute | Optional | Description | -| ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `keep_days` | yes | The number of history days to keep in recorder database (defaults to the integration `purge_keep_days` configuration) | -| `repack` | yes | Rewrite the entire database, possibly saving some disk space. Only supported for SQLite and requires at least as much disk space free as the database currently uses. | +| Service data attribute | Optional | Description | +| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `keep_days` | yes | The number of history days to keep in recorder database (defaults to the integration `purge_keep_days` configuration) | +| `repack` | yes | Rewrite the entire database, possibly saving some disk space. This is a heavy operation that can cause slowdowns and increased disk space usage while it runs. Only supported for SQLite and PostgreSQL. | ## Custom database engines From 28f09cbbc702361fbf5512f990519215b66b1475 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Thu, 16 Apr 2020 23:48:37 +0200 Subject: [PATCH 2/4] Update source/_integrations/recorder.markdown Co-Authored-By: J. Nick Koston --- source/_integrations/recorder.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/recorder.markdown b/source/_integrations/recorder.markdown index 50111d758e59..479f021b49b6 100644 --- a/source/_integrations/recorder.markdown +++ b/source/_integrations/recorder.markdown @@ -48,7 +48,7 @@ recorder: default: 3 type: integer auto_purge: - description: Automatically purge the database every night. This keeps it from growing indefinitely. If you disable this, you can still use the service [`recorder.purge`](#service-purge) when required. + description: Automatically purge the database every night at 04:12 local time. Purging keeps the database from growing indefinitely, which will make Home Assistant slow. If you disable `auto_purge` it is recommended that you create an automation to call the [`recorder.purge`](#service-purge) periodically. required: false default: true type: boolean From 3129afb8d7287982b00ba41faafd955ea3007982 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Thu, 16 Apr 2020 23:51:20 +0200 Subject: [PATCH 3/4] Update source/_integrations/recorder.markdown --- source/_integrations/recorder.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/recorder.markdown b/source/_integrations/recorder.markdown index 479f021b49b6..dbed426c6eba 100644 --- a/source/_integrations/recorder.markdown +++ b/source/_integrations/recorder.markdown @@ -48,7 +48,7 @@ recorder: default: 3 type: integer auto_purge: - description: Automatically purge the database every night at 04:12 local time. Purging keeps the database from growing indefinitely, which will make Home Assistant slow. If you disable `auto_purge` it is recommended that you create an automation to call the [`recorder.purge`](#service-purge) periodically. + description: Automatically purge the database every night at 04:12 local time. Purging keeps the database from growing indefinitely, which takes up disk space and can make Home Assistant slow. If you disable `auto_purge` it is recommended that you create an automation to call the [`recorder.purge`](#service-purge) periodically. required: false default: true type: boolean From 17982029d0ccd6e624ef9fef4ed122b1bb516c25 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Fri, 17 Apr 2020 11:12:26 +0200 Subject: [PATCH 4/4] Add a note about purging not releasing disk space --- source/_integrations/recorder.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_integrations/recorder.markdown b/source/_integrations/recorder.markdown index dbed426c6eba..740a56ea1205 100644 --- a/source/_integrations/recorder.markdown +++ b/source/_integrations/recorder.markdown @@ -146,6 +146,7 @@ If you only want to hide events from your history, take a look at the [`history` ### Service `purge` Call the service `recorder.purge` to start a purge task which deletes events and states older than x days, according to `keep_days` service data. +Note that purging will not immediately decrease disk space usage but it will significantly slow down further growth. | Service data attribute | Optional | Description | | ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |