Get Virtualizor

Show Logs

Logging information is critical to providing accurate and efficient technical support and troubleshooting. Logging in Virtualizor is enabled by default. For getting the logs you can use the Show Logs API to show the logs of a particular task by passing the task's actid.

HTTP Request

https://hostname:4085/index.php?act=tasks

Parameters

NameMethodValueDescriptionRequired
actGETtasksThe action will return the tasks that had been performedYes
show_logsPOSTIntReturns the logs of a specific task by passing task's actidYes

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);

    $post = array();
    $page = 1;
    $reslen = 1;
    $post['show_logs'] = 484;

    $output = $admin->tasks($page, $reslen, $post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Tasks List",
    "tasks": null,
    "logs_data": {
        "logs": {
            "Download_OS": "Starting Task : 484\nOS to Fetch :\n
Array\n(\n    [0] => 100008\n)\n
\n[100008] Current OS to Fetch : 100008\n[100008] File Path : /var/virtualizor/kvm/ubuntu-mini2.iso\n[100008] Starting download from URL : http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso\n[100008] Downloaded Successfully ... Continuing\nPHP Notice:  Undefined index: uid in /usr/local/virtualizor/scripts/os.php on line 181\nCompleted task\nEmailed Admin !"
        }
    },
    "l_common_logs": "The logs shown are the last operation performed for this task by virtualizor",
    "timenow": 1536149460,
    "time_taken": "0.265"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list