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.
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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 curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/status ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X GET
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/status"
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
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 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 Show:
Success (HTTP Response Code 200 OK)
Success (HTTP Response Code 200 OK) {"status":"ok","version":"1.8.2--build-11362--sha-173241677d"}
The returned JSON has the following structure:
Table:
Field Type Description status string
The node status
version string
The current version of LogScale that the node is running
If you end up in a situation where you have lost data/segment files, you
need to remove these from Global.
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.
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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 curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/missing-segments ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X GET
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/missing-segments"
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
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 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 Show:
Success (HTTP Response Code 200 OK)
Success (HTTP Response Code 200 OK) FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000
The returned JSON has the following structure:
Table:
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
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.
The following example demonstrates a command that deletes all missing
segments in the system:
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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 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 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 curl.exe -X DELETE
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/delete-missing-segments"
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
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 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);
}
The following example deletes an explicit list of missing segments, and
fails on error:
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json" ^
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
"$YOUR_LOGSCALE_URL /api/v1/delete-missing-segments"
Perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN" ;
my $uri = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments' ;
my $json = "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000" ;
my $req = HTTP::Request->new("POST" , $uri );
$req->header("Authorization" => "Bearer $TOKEN" );
$req->header("Content-Type" => "application/json" );
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content" },"\n" ;
Python
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments'
mydata = r'''FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000'''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN" ,
"Content-Type" : "application/json"
}
)
print (resp.text)
Node.js const https = require ('https' );
const data = JSON .stringify (
"FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
);
const options = {
hostname : '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments' ,
path : '/graphql' ,
port : 443 ,
method : 'POST' ,
headers : {
'Content-Type' : 'application/json' ,
'Content-Length' : data.length ,
Authorization : 'BEARER ' + process.env .TOKEN ,
'User-Agent' : 'Node' ,
},
};
const req = https.request (options, (res ) => {
let data = '' ;
console .log (`statusCode: ${res.statusCode} ` );
res.on ('data' , (d ) => {
data += d;
});
res.on ('end' , () => {
console .log (JSON .parse (data).data );
});
});
req.on ('error' , (error ) => {
console .error (error);
});
req.write (data);
req.end ();
The following example deletes an explicit list of missing segments, and
ignores any errors:
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json" ^
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
-d "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
"$YOUR_LOGSCALE_URL /api/v1/delete-missing-segments?ignoreErrors=true"
Perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN" ;
my $uri = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true' ;
my $json = "FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000" ;
my $req = HTTP::Request->new("POST" , $uri );
$req->header("Authorization" => "Bearer $TOKEN" );
$req->header("Content-Type" => "application/json" );
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content" },"\n" ;
Python
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true'
mydata = r'''FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000'''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN" ,
"Content-Type" : "application/json"
}
)
print (resp.text)
Node.js const https = require ('https' );
const data = JSON .stringify (
"FWEClWu82dW46QqpOWFrGcUO SknGDKCcOScTxvkEEAMsgCvX KYneZu6juzjdsHbfH3YWn7YS 'developer' '@host=test_host@source=test_source@type=kv@' 1451606400000 1451606400000"
);
const options = {
hostname : '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true' ,
path : '/graphql' ,
port : 443 ,
method : 'POST' ,
headers : {
'Content-Type' : 'application/json' ,
'Content-Length' : data.length ,
Authorization : 'BEARER ' + process.env .TOKEN ,
'User-Agent' : 'Node' ,
},
};
const req = https.request (options, (res ) => {
let data = '' ;
console .log (`statusCode: ${res.statusCode} ` );
res.on ('data' , (d ) => {
data += d;
});
res.on ('end' , () => {
console .log (JSON .parse (data).data );
});
});
req.on ('error' , (error ) => {
console .error (error);
});
req.write (data);
req.end ();
The following example deletes all missing segments, and ignores any
errors:
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true"
Perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN" ;
my $uri = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true' ;
my $json = '' ;
my $req = HTTP::Request->new("POST" , $uri );
$req->header("Authorization" => "Bearer $TOKEN" );
$req->header("Content-Type" => "application/json" );
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content" },"\n" ;
Python
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN" ,
"Content-Type" : "application/json"
}
)
print (resp.text)
Node.js const https = require ('https' );
const options = {
hostname : '$YOUR_LOGSCALE_URL/api/v1/delete-missing-segments?ignoreErrors=true&deleteAll=true' ,
path : '/graphql' ,
port : 443 ,
method : 'POST' ,
headers : {
'Content-Type' : 'application/json' ,
'Content-Length' : data.length ,
Authorization : 'BEARER ' + process.env .TOKEN ,
'User-Agent' : 'Node' ,
},
};
const req = https.request (options, (res ) => {
let data = '' ;
console .log (`statusCode: ${res.statusCode} ` );
res.on ('data' , (d ) => {
data += d;
});
res.on ('end' , () => {
console .log (JSON .parse (data).data );
});
});
req.on ('error' , (error ) => {
console .error (error);
});
req.write (data);
req.end ();