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.
Global environment variables are cleared, for security reasons, when the script is called. You can set additional environment variables in the "command" configuration section. 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, TLS and headers configurations. See the HTTP Clients (http
) section of the config reference.
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