Logging information is critical to providing accurate and efficient technical support and troubleshooting. Logging in Virtualizor is enabled by default. The time period for the retention of the logs can be set in the Master Settings of the Admin panel or using the master configurations API.
Use the Admin Logs API to retrieve logs about the admin activity. These activities include creation/deletion of VPS, changing the backup settings, etc complete list of activities are given in the below table. The API response contains the list of the admin logs, which are listed according to their "actid". To filter or limit the size of the list you can pass in one or more query parameters.
HTTP Request
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | logs | The action will return the logs | Yes |
id | GET | Int | The logs will be searched according to the vps ID | No |
GET | text | The logs will be searched according to the email | No | |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
page | GET | Int | Page number, each page show 50 records | No |
Activites
action | description |
---|---|
addvs | Creating VPS |
addvs_restore | Creating VPS for Restore |
rebuildvs | Rebuilding VPS |
vpsbackups | Backing up VPS |
restorevps | Restoring VPS |
migrate2 | Migrating VPS |
multimigrateprog | Multiple Migrate |
clone2 | Cloning VPS |
multicloneprog | Multiple Clone |
deletevs | Deleting VPS |
createtemplate | Creating Template |
fstab_handle | FS Tab Handle |
editxcpvs | Edit XCP VPS |
resizevps | Resizing VPS |
multivirt | Enabling Multivirt |
getos | Downloading OS |
change_dnsnameserver | Changing DNS Nameserver |
changepassword | Changing VPS Password |
install_cp | Install Control panel |
hostname | Changing VPS Hostname |
install_recipe | Install Recipe |
bandwidth_unsuspend | Unsuspend Bandwidth |
suspend_callback | Suspend Callback |
unsuspend_callback | Unsuspend Callback |
editvps_callback | Edit VPS Callback |
terminate_callback | Terminate VPS Callback |
get_crt | Lets Encrypt Install Certificate |
renew_crt | Lets Encrypt Renew Certificate |
cron_crt | Lets Encrypt Renew Certificate Cron Task |
haproxy_cron | HAProxy Rebuild |
vpsbackups_plan | VPS Backups |
restorevps_plan | VPS Restore |
addsshkeys | Adding SSH Keys |
installxentools | Installing Xenserver Tools |
dbbackups | Database Backup |
install_script | Installing Apps |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$page = 1;
$reslen = 3;
$post = array();
$post['id'] = '';
$post['email'] = '';
$output = $admin->logs($page, $reslen);
print_r(json_encode($output));
?>
Output
{
"title": "Logs",
"logs": {
"7430": {
"actid": "7430",
"uid": "0",
"id": "3273",
"action": "editvs",
"data": "v1949",
"time": "1471415822",
"status": "1",
"ip": "120.62.45.250",
"email": "root"
},
"7429": {
"actid": "7429",
"uid": "0",
"id": "2963",
"action": "editvs",
"data": "v1828",
"time": "1471415792",
"status": "1",
"ip": "120.62.45.250",
"email": "root"
},
"7428": {
"actid": "7428",
"uid": "0",
"id": "1",
"action": "setbackupsettings",
"data": "",
"time": "1471399037",
"status": "1",
"ip": "120.62.45.250",
"email": "root"
}
},
"timenow": "1471416157",
"time_taken": "0.10"
}