Get Virtualizor

IP Logs

Virtualizor has logging enabled by default. For auditing the IP address usage you can use the IP Logs API.

These logs are related to the IP address that are added on the admin panel. Virtualizor logs the IP address if it is used while creating or editing the VPS alongwith the email of the enduser.

The IP Logs are stored indefinitely on the server and can be removed from the admin panel or by using the Delete IP Logs API

HTTP Request

https://hostname:4085/index.php?act=iplogs&vpsid=VPSID&ip=IP&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETiplogsThe action will return the ip logsYes
ipGETtextThe logs will be returned on the basis of the ipNo
vpsidGETIntThe logs will be returned on the basis of the vps IDNo
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'] = '74';
    $post['ip'] = '';

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

    print_r(json_encode($output));

?>

Output

{
    "title": "IP Logs",
    "current_status": null,
    "iplogs": [
        {
            "iplid": "191",
            "ipid": "408",
            "ip": "10.0.0.2",
            "vpsid": "74",
            "uid": "57",
            "email": "samplemail@gmail.com",
            "cloud_uid": "0",
            "cloud_email": "0",
            "time": "1536261694",
            "date": "1536261694"
        },
        {
            "iplid": "189",
            "ipid": "408",
            "ip": "10.0.0.2",
            "vpsid": "74",
            "uid": "57",
            "email": "samplemail@gmail.com",
            "cloud_uid": "0",
            "cloud_email": "0",
            "time": "1536157269",
            "date": "1536157269"
        }
    ],
    "timenow": 1536687535,
    "time_taken": "0.205"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list