mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
1.6 KiB
1.6 KiB
Data retention hook
This hook runs after a data retention check completes if you specify Hook
between notifications methods when you start the check.
The data_retention_hook
can be defined as the absolute path of your program or an HTTP URL.
If the hook defines an external program it can read the following environment variable:
SFTPGO_DATA_RETENTION_RESULT
, it contains the data retention check result JSON serialized.
Previous global environment variables aren't cleared when the script is called. The program must finish within 20 seconds.
If the hook defines an HTTP URL then this URL will be invoked as HTTP POST and the POST body contains the data retention check result JSON serialized.
The HTTP hook will use the global configuration for HTTP clients and will respect the retry configurations.
Here is the schema for the data retention check result:
username
, stringstatus
, int. 1 means success, 0 errorstart_time
, int64. Start time as UNIX timestamp in millisecondstotal_deleted_files
, int. Total number of files deletedtotal_deleted_size
, int64. Total size deleted in byteselapsed
, int64. Elapsed time in millisecondsdetails
, list of struct with details for each checked path, each struct contains the following fields:path
, stringretention
, int. Retention time in hoursdeleted_files
, int. Number of files deleteddeleted_size
, int64. Size deleted in bytesinfo
, string. Informative, non fatal, message if any. For example it can indicates that the check was skipped because the user doesn't have the required permissions on this patherror
, string. Error message if any