Remote.cgi list-backup-logs json/xml output weirdness

SYSTEM INFORMATION
OS type and version ubuntu 22.04
Webmin version 2.111
Virtualmin version 7.20.2 Pro

I’m trying to setup some monitoring of backups across multiple servers.

To do this I’m using the api from python via the requests library.

When I get the results back the first row returned is not like the others - it is missing information

sample url: 'https://<REDACTED>:10000/virtual-server/remote.cgi?program=list-backup-logs&multiline&start=2024-08-01&json=1&multiline'

This will return:

{
   "data" : [
      {
         "value" : "",
         "name" : "1722474098-1720760-1"
      },
      {
         "values" : {
            "differential" : [
               "No"
            ],
            "final_status" : [
               "OK"
            ],
            "encrypted" : [
               "No"
            ],
            "format" : [
               "One file per server"
            ],
            "compression" :<REDACTED>@<REDACTED>": [
               "tar.gz"
            ],
            "started" : [
               "08/02/2024 12:00 AM"
            ],
            "final_size" : [
               "18569073997"
            ],
            "destination" : [
               "s3://<REDACTED>:<REDACTED>@<REDACTED>"
            ],
            "final_nice_size" : [
               "17.29 GiB"
            ],
            "domains" : [
               "<REDACTED>"
            ],
            "ended" : [
               "08/02/2024 12:56 AM"
            ],
            "scheduled_destination" : [
               "s3://<REDACTED>:<REDACTED>@<REDACTED>"
            ],
            "scheduled_backup_id" : [
               "1674191266448203"
            ],
            "run_from" : [
               "sched"
            ]
         },
         "name" : "1722560181-2337146-1:"
      }
   ],
   "status" : "success",
   "command" : "list-backup-logs"
}

Note that the first element of the data array does not have a “values” key, it has “value” instead (with an empty string)

Using xml=1 has a similar result. First element has value instead of values and no data.

Running this at the command line gives me data for both backups.

root@www-05:~# virtualmin list-backup-logs --multiline --start 2024-08-01 
1722474098-1720760-1:
    Domains: <REDACTED>
    Destination: s3://<REDACTED>:<REDACTED>@<REDACTED>
    Differential: No
    Compression: tar.gz
    Format: One file per server
    Started: 08/01/2024 12:00 AM
    Ended: 08/01/2024 01:01 AM
    Final size: 18531002028
    Final nice size: 17.25 GiB
    Final status: OK
    Run from: sched
    Scheduled backup ID: 1674191266448203
    Scheduled destination: s3://<REDACTED>:<REDACTED>@<REDACTED>
    Encrypted: No
1722560181-2337146-1:
    Domains: <REDACTED>
    Destination: s3://<REDACTED>:<REDACTED>@<REDACTED>
    Differential: No
    Compression: tar.gz
    Format: One file per server
    Started: 08/02/2024 12:00 AM
    Ended: 08/02/2024 12:56 AM
    Final size: 18569073997
    Final nice size: 17.29 GiB
    Final status: OK
    Run from: sched
    Scheduled backup ID: 1674191266448203
    Scheduled destination: s3://<REDACTED>:<REDACTED>@<REDACTED>
    Encrypted: No

Am I doing something wrong or is there a problem in the code producing the xml/json output?

I’d really rather not have to parse the multiline text format.

Also, while here can I upvote the request for json output from the cli (as per this) I would also rather doi this via ssh keys than be storing priviliged credentials in my automation.

Thanks,
Neill

Ok I see the bug that causes this in Virtualmin - it will be fixed in the next release.

@neill Can you please apply the following patch by Jamie and see if that fixes the original issue for you:

webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/6752266

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.