Miscellaneous Cluster Management API Endpoints

Status Endpoint

The status endpoint can be used to check whether the node can be reached and which version it is running. This is useful as a smoke test after an update or as a health check to be used with service discovery tools such as Consul.

Description Check whether node can be reached and current version.
MethodGET /api/v1/status
Response Datastatus
Authentication Requiredno
Return Codes
200 Request complete
400 Bad authentication
500 Request failed
Mac OS or Linux (curl)
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"
Mac OS or Linux (curl) One-line
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"
Windows Cmd and curl
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json"
Windows Powershell and curl
powershell
curl.exe -X GET 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    "$YOUR_LOGSCALE_URL/api/v1/status"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $INGEST_TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/api/v1/status';

my $req = HTTP::Request->new("GET", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");


my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/api/v1/status'

resp = requests.get(url,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

let request = https.get('$YOUR_LOGSCALE_URL/api/v1/status', (res) => {
  if (res.statusCode !== 200) {
    console.error(`Error from server. Code: ${res.statusCode}`);
    res.resume();
    return;
  }

  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('close', () => {
    console.log('Response:');
    console.log(JSON.parse(data));
  });
});

    return(undef,undef);
}
Example Responses
Success (HTTP Response Code 200 OK)
shell
{"status":"ok","version":"1.8.2--build-11362--sha-173241677d"}

The returned JSON has the following structure:

Table: Response Structure

FieldTypeDescription
statusstring The node status
versionstring The current version of LogScale that the node is running

Missing Segments

If you end up in a situation where you have lost data/segment files, you need to remove these from Global.

Description Returns list of all missing segments in CSV format.
MethodGET /api/v1/missing-segments
Response Datamissing-segments
Authentication Requiredyes
Return Codes
200 Request complete
400 Bad authentication
500 Request failed

The missing segments API will list all segments that no longer exist. The format is line-based and each line specifies one missing segment. This format matches the input format of the Delete Missing Segments API.

Mac OS or Linux (curl)
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"
Mac OS or Linux (curl) One-line
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"
Windows Cmd and curl
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json"
Windows Powershell and curl
powershell
curl.exe -X GET 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    "$YOUR_LOGSCALE_URL/api/v1/missing-segments"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $INGEST_TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/api/v1/missing-segments';

my $req = HTTP::Request->new("GET", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");


my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/api/v1/missing-segments'

resp = requests.get(url,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

let request = https.get('$YOUR_LOGSCALE_URL/api/v1/missing-segments', (res) => {
  if (res.statusCode !== 200) {
    console.error(`Error from server. Code: ${res.statusCode}`);
    res.resume();
    return;
  }

  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('close', () => {
    console.log('Response:');
    console.log(JSON.parse(data));
  });
});

    return(undef,undef);
}
Example Responses
Success (HTTP Response Code 200 OK)
shell
FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000

The returned JSON has the following structure:

Table: Response Structure

FieldTypeDescription
SegmentIdstring The segment ID
datasourceIdstring The datasource ID
dataspaceIdstring The dataspace ID
endUnixTimeMsinteger The UNIX end time in milliseconds
repositoryNamestring The repository name
startUnixTimeMsinteger The UNIX start time in milliseconds
tagStringstring The tag string

Delete Missing Segments

Description Remove missing segments from the cluster.  
MethodPOST /api/v1/delete-missing-segments 
Request Datamissing-segments 
Authentication Requiredyes 
Query ArgumentsDescriptionData typeRequired?
deleteAll Force deletion of all missing segments in the cluster. booleanoptional
 Supported Values  
 falseDelete missing segments according to the list of segments. 
 trueDelete all missing segments; segment list not required. 
ignoreErrors Force deletion of the bucket storage configuration booleanoptional
 Supported Values  
 falseDeletes only if not used in an active configuration 
 trueIgnore errors when deleting missing segments 
Return Codes 
200 Request complete  
400 Bad authentication  
500 Request failed  

This API uses the POST HTTP method.

You can supply a list of segments to delete, the format is the same as the output from Missing Segments, but note that empty lines are disallowed. Strictly speaking, only the first three fields on each line are needed; the rest will be ignored. If errors occur during the deletion process, they will be aborted.

You can provide the query parameter ignoreErrors=true (defaults to false). When using this, errors during the deletion process will be ignored.

You can provide the query parameter deleteAll=true (defaults to false). When using this, providing a list of segments will not be needed. All missing segments in the cluster will be deleted. This is a one-shot "command" that will clean up the system.

Mac OS or Linux (curl)
shell
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"
Mac OS or Linux (curl) One-line
shell
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"
Windows Cmd and curl
shell
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json"
Windows Powershell and curl
powershell
curl.exe -X DELETE 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    "$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $INGEST_TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments';

my $req = HTTP::Request->new("DELETE", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");


my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments'

resp = requests.delete(url,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

let request = https.delete('$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments', (res) => {
  if (res.statusCode !== 200) {
    console.error(`Error from server. Code: ${res.statusCode}`);
    res.resume();
    return;
  }

  let data = '';

  res.on('data', (chunk) => {
    data += chunk;
  });

  res.on('close', () => {
    console.log('Response:');
    console.log(JSON.parse(data));
  });
});

    return(undef,undef);
}

Example - explicit list, fail on error:

shell
$ curl -s https://$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
  -d'FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS' \
  'developer' '@host=test_host@source=test_source@type=kv@' '1451606400000 1451606400000'

Example - explicit list, ignore errors:

shell
$ curl -s 'https://$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true' \
  -d'FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS' \
  'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000'

Example - delete all, ignore errors:

shell
$ curl -s -XPOST 'https://$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true'