Admin Logs

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

https://hostname:4085/index.php?act=logs&id=ID&email&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETlogsThe action will return the logsYes
idGETIntThe logs will be searched according to the vps IDNo
emailGETtextThe logs will be searched according to the emailNo
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo

Activites

actiondescription
addvsCreating VPS
addvs_restoreCreating VPS for Restore
rebuildvsRebuilding VPS
vpsbackupsBacking up VPS
restorevpsRestoring VPS
migrate2Migrating VPS
multimigrateprogMultiple Migrate
clone2Cloning VPS
multicloneprogMultiple Clone
deletevsDeleting VPS
createtemplateCreating Template
fstab_handleFS Tab Handle
editxcpvsEdit XCP VPS
resizevpsResizing VPS
multivirtEnabling Multivirt
getosDownloading OS
change_dnsnameserverChanging DNS Nameserver
changepasswordChanging VPS Password
install_cpInstall Control panel
hostnameChanging VPS Hostname
install_recipeInstall Recipe
bandwidth_unsuspendUnsuspend Bandwidth
suspend_callbackSuspend Callback
unsuspend_callbackUnsuspend Callback
editvps_callbackEdit VPS Callback
terminate_callbackTerminate VPS Callback
get_crtLets Encrypt Install Certificate
renew_crtLets Encrypt Renew Certificate
cron_crtLets Encrypt Renew Certificate Cron Task
haproxy_cronHAProxy Rebuild
vpsbackups_planVPS Backups
restorevps_planVPS Restore
addsshkeysAdding SSH Keys
installxentoolsInstalling Xenserver Tools
dbbackupsDatabase Backup
install_scriptInstalling 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"
}
Was this helpful to you?