.. _vms_cleanup: Remove Video Records ======================================================= .. seealso:: :ref:`configure-vms` There are two methods of video archive cleanup available in the system: #. Regular cleanup #. Manual cleanup via a console command .. rubric:: In this section: .. contents:: :local: .. _regular-cleanup: Regular Video Cleanup ---------------------------------------- To configure the regular video cleanup, do the following: #. Open the ``/opt/findface-multi/configs/findface-multi-legacy/findface-multi-legacy.py`` configuration file. .. code:: sudo vi /opt/findface-multi/configs/findface-multi-legacy/findface-multi-legacy.py #. Find the ``SERVICES`` section and set ``"vms_cleanup": True``. .. code:: SERVICES = { "ffsecurity": { ... "vms_cleanup": True, } } #. Find the ``VMS_CLEANUP_SETTINGS`` section and configure what video to remove, using the following parameters: * ``'CLEANUP_BETWEEN_TRACKS'``: set ``True`` to remove video intervals that do not contain recognition events * ``'CLEANUP_ARCHIVE'``: set ``True`` to remove the entire video archive older than a given number of days * ``'ARCHIVE_CLEANUP_AGE'``: the maximum age of video archive in the system, days. Applicable if ``'CLEANUP_ARCHIVE': True`` * ``'CLEANUP_EVENTS_TYPES'``: event types that will be kept in the video archive, in the form of a dictionary, e.g., ['face', 'body', 'car'] * ``'KEEP_EVENT_BEFORE_AFTER'``: interval before and after a track with events, that won't be removed in order to preserve meaningful information related to them, seconds. The value must be less than ``CLEANUP_THRESHOLD`` * ``'CLEANUP_THRESHOLD'``: minimum interval between tracks with events, seconds. If the interval between tracks is shorter, it won't be removed .. tip:: See the RRULE calculator `here `__. .. code:: 'VMS_CLEANUP_SETTINGS': { 'CLEANUP_BETWEEN_TRACKS': True, 'CLEANUP_ARCHIVE': True, 'ARCHIVE_CLEANUP_AGE': 9, 'CLEANUP_EVENTS_TYPES': ['car'], # Add `safe_time_interval` in seconds to each `track` subject to delete # Prevents deletion of essential data. # Should be lower than CLEANUP_THRESHOLD 'KEEP_EVENT_BEFORE_AFTER': 10, # minimal allowed value # Threshold between `intervals` in seconds. # If duration between `tracks` < `CLEANUP_THRESHOLD` # interval between tracks will not be added to deletion tasks 'CLEANUP_THRESHOLD': 360, # minimal allowed value }, #. Find the ``'VMS_CLEANUP_SERVICE_SCHEDULE'`` parameter and specify a recurrence rule (RRULE) for scheduling video cleanup. .. tip:: See the RRULE calculator `here `__. .. code:: # rrule (recurrence rule) for scheduling `vms_cleanup` service 'VMS_CLEANUP_SERVICE_SCHEDULE': 'RRULE:FREQ=HOURLY;INTERVAL=3;WKST=MO', #. Restart the ``findface-multi-findface-multi-legacy-1`` container. .. code:: sudo docker container restart findface-multi-findface-multi-legacy-1 Manual Video Cleanup ----------------------- You can manually remove video chunks older than the given number of days by executing the command below. To set the number of days, use the --vms-videos-max-age argument. .. code:: sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup_vms --vms-videos-max-age=30