New Feature: JSON backup report

Starting from version 1.2.0, there is an option Send report after completion on the Backup page, which will allow you to send a report to an http/https address after a backup is completed.

The default format for this report is:

{
  "computer": "mac-mini",
  "directory": "/Users/gchen/repository",
  "end_time": 1580837217,
  "new_chunk_size": 0,
  "new_chunks": 0,
  "new_file_chunk_size": 0,
  "new_file_chunks": 0,
  "new_file_size": 0,
  "new_files": 0,
  "new_metadata_chunk_size": 0,
  "new_metadata_chunks": 0,
  "result": "Error",
  "start_time": 1580837217,
  "storage": "local.storage",
  "storage_url": "/Users/gchen/storage",
  "total_chunk_size": 0,
  "total_chunks": 0,
  "total_file_chunk_size": 0,
  "total_file_chunks": 0,
  "total_file_size": 0,
  "total_files": 0,
  "total_metadata_chunk_size": 0,
  "total_metadata_chunks": 0,
  "upload_chunk_size": 0,
  "upload_file_chunk_size": 0,
  "upload_metadata_chunk_size": 0
}

These stats are extracted from the BACKUP_STATS logs in the backup log.

To customize the report format, create a file named report.tmpl under ~/.duplicacy-web, such as:

{
    "BackupResult": "{{.result}}",
    "BeginTime": {{.start_time}},
    "TotalFiles": {{.total_files}},
    "Storage": "{{.storage_url}}"
}

All tokens in the form of {{.<key>}} will be replaced be replaced by the corresponding value in the json file above. The final report based on that report.tmpl file will be:

{
    "BackupResult": "Error",
    "BeginTime": 1580837417,
    "TotalFiles": 0,
    "Storage": "/Users/gchen/storage"
}
8 Likes