ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
577 stars 25 forks source link

Purging old files a week after creation? #73

Closed paulhaigh closed 1 year ago

paulhaigh commented 1 year ago

Description

Running unifi-protect-backup as a cron job, and noticed in the log the following:

2023-01-11 13:38:39 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Starting...
2023-01-11 13:38:39 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Checking rclone configuration...
2023-01-11 13:38:39 [   DEBUG   ] unifi_protect_backup.unifi_protect_backup  :  rclone found: /usr/bin/rclone
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Connecting to Unifi Protect...
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Found cameras:
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :   - 6113b4410315db0387000ed1: Driveway
2023-01-11 13:38:40 [   DEBUG   ] unifi_protect_backup.unifi_protect_backup  :  NVR TZ: Europe/London
2023-01-11 13:38:40 [   DEBUG   ] unifi_protect_backup.unifi_protect_backup  :  Local TZ: UTC
2023-01-11 13:38:40 [   DEBUG   ] unifi_protect_backup.downloader            :  ffprobe found: /usr/bin/ffprobe
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Starting...
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.downloader            :  Starting Downloader
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.uploader              :  Starting Uploader
2023-01-11 13:38:40 [   DEBUG   ] unifi_protect_backup.event_listener        :  Subscribed to websocket
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.missing_event_checker :  Starting Missing Event Checker
2023-01-11 13:38:40 [   INFO    ] unifi_protect_backup.purge                 :  Purging event: 63b44924026a14038707c0e9.
2023-01-11 13:38:40 [   DEBUG   ] unifi_protect_backup.purge                 :   Deleted: OneDrive:/Backups/Unifi-Protect/Driveway/2023-01-03/2023-01-03T15-26-41 smartDetectZone (vehicle).mp4
2023-01-11 13:38:41 [   DEBUG   ] unifi_protect_backup.missing_event_checker :   Total undownloaded events: 0
2023-01-11 13:38:41 [   DEBUG   ] unifi_protect_backup.missing_event_checker :   Undownloaded events of wanted types: 0
2023-01-11 13:38:46 [   INFO    ] unifi_protect_backup.purge                 :  Purging event: 63b5352402b4140387084879.
2023-01-11 13:38:46 [   DEBUG   ] unifi_protect_backup.purge                 :   Deleted: OneDrive:/Backups/Unifi-Protect/Driveway/2023-01-04/2023-01-04T08-13-31 smartDetectZone (person).mp4
2023-01-11 13:38:51 [   INFO    ] unifi_protect_backup.purge                 :  Purging event: 63b55903013114038708634e.
2023-01-11 13:38:51 [   DEBUG   ] unifi_protect_backup.purge                 :   Deleted: OneDrive:/Backups/Unifi-Protect/Driveway/2023-01-04/2023-01-04T10-46-43 motion.mp4

I'm not sure why it's purging files that were uploaded less than a week ago? Is the default Cloud retention set to 7 days?

I assumed it would keep a copy of all motion events on the local server for as long as they were located on the local server, but appears wrong?

What I Did

Ran unifi-protect-backup -v (log as above).

paulhaigh commented 1 year ago

I'm so sorry - found this in the docs:


  --retention TEXT                How long should event clips be backed up
                                  for. Format as per the `--max-age` argument
                                  of `rclone`
                                  (https://rclone.org/filtering/#max-age-don-t-transfer-any-file-older-than-this)
                                  [default: 7d]