Introduce recorder auto_purge, remove purge_interval (#12690)

* Introduce recorder auto_purge, remove purge_interval

* Update source/_integrations/recorder.markdown

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update source/_integrations/recorder.markdown

* Add a note about purging not releasing disk space

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Anders Melchiorsen 2020-04-17 11:35:41 +02:00 committed by GitHub
parent c5a1de1865
commit 90ffc6a277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,16 +47,16 @@ recorder:
required: false required: false
default: 3 default: 3
type: integer type: integer
auto_purge:
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
purge_keep_days: purge_keep_days:
description: Specify the number of history days to keep in recorder database after a purge. description: Specify the number of history days to keep in recorder database after a purge.
required: false required: false
default: 10 default: 10
type: integer 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: 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. 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 required: false
@ -94,7 +94,7 @@ recorder:
type: list type: list
{% endconfiguration %} {% 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 ```yaml
# Example configuration.yaml entry with exclude # Example configuration.yaml entry with exclude
@ -113,7 +113,7 @@ recorder:
- call_service # Don't record service calls - 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 ```yaml
# Example configuration.yaml entry with include # Example configuration.yaml entry with include
@ -146,11 +146,12 @@ If you only want to hide events from your history, take a look at the [`history`
### Service `purge` ### 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. 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 | | 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) | | `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. | | `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 ## Custom database engines