Get Virtualizor

User 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 User logs can be set in the Master Settings of the Admin panel or using the master configurations API.

Use the User Logs API to retrieve logs about the users activity. These includes activities such as time when the user started up the VPS, stopped the VPS and restarted the VPS. For more information about the users activity you can use the "actid" return by this API in the Tasks API.

The API response contains the list of the user 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=userlogs&vpsid=VPSID&email=EMAIL&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETuserlogsThe action will return the user logsYes
vpsidGETIntThis will search logs based on the vpsidNo
emailGETtextThis will search logs based on the emailNo
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo

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 = 20;
    $post = array();
    $post['vpsid'] = 3628;
    $post['email'] = '';    

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

    print_r(json_encode($output));

?>

Output

{
    "title": "User Logs",
    "userlogs": {
        "105": {
            "actid": "105",
            "uid": "0",
            "vpsid": "3628",
            "action": "start",
            "data": "",
            "time": "1481381700",
            "status": "1",
            "ip": "",
            "email": "root"
        }
    },
    "timenow": "1481540492",
    "time_taken": "0.110"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list