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. | |
Method | GET /api/v1/status | |
Response Data | status | |
Authentication Required | no | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X GET
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/status"
#!/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";
#! /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)
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);
}
{"status":"ok","version":"1.8.2--build-11362--sha-173241677d"}
The returned JSON has the following structure:
Table: Response Structure
Field | Type | Description |
---|---|---|
status | string | The node status |
version | string | 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. | |
Method | GET /api/v1/missing-segments | |
Response Data | missing-segments | |
Authentication Required | yes | |
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.
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X GET
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/missing-segments"
#!/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";
#! /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)
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);
}
FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000
The returned JSON has the following structure:
Table: Response Structure
Field | Type | Description |
---|---|---|
SegmentId | string | The segment ID |
datasourceId | string | The datasource ID |
dataspaceId | string | The dataspace ID |
endUnixTimeMs | integer | The UNIX end time in milliseconds |
repositoryName | string | The repository name |
startUnixTimeMs | integer | The UNIX start time in milliseconds |
tagString | string | The tag string |
Delete Missing Segments
Description | Remove missing segments from the cluster. | ||
Method | POST /api/v1/delete-missing-segments | ||
Request Data | missing-segments | ||
Authentication Required | yes | ||
Query Arguments | Description | Data type | Required? |
deleteAll | Force deletion of all missing segments in the cluster. | boolean | optional |
Supported Values | |||
false | Delete missing segments according to the list of segments. | ||
true | Delete all missing segments; segment list not required. | ||
ignoreErrors | Force deletion of the bucket storage configuration | boolean | optional |
Supported Values | |||
false | Deletes only if not used in an active configuration | ||
true | Ignore 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.
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X DELETE
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments"
#!/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";
#! /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)
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:
$ 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:
$ 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:
$ curl -s -XPOST 'https://$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true'