Logs auto deletion
==================


It is possible to run streams logs auto deletion.
This is needs to clean the database from a large number of unnecessary records.
The most recent record for each stream will not be deleted.

You can configure logs auto deletion by `LUNA_STREAMS_LOGS_CLEAR_INTERVAL` setting.

    * `interval` - Integer. Logs older than interval will delete.

    * `interval_type` - String. Type of interval ("weeks", "days", "hours", "minutes", "seconds")

    * `check_interval` - Integer. In seconds. How often background task will check logs for deletion.

    * `active` - Boolean. If set to *true* logs auto deletion will be enabled, otherwise will not.

By default auto deletion stopped.
For example default setting values run auto deletion with check streams logs in data base each `180` seconds
and delete logs older than `7 days`.

For example if it needs to check each 5 minutes for delete logs older than 4 weeks, set values below:

.. code-block:: json

    {
        "interval": 4,
        "interval_type": "weeks",
        "check_interval": 300,
        "active": true
    }
