List Bucket Storage Targets
LogScale keeps a record of all the buckets that have ever been
configured, even if the bucket is not in the current configuration. For
the GET
form, this endpoint returns the
list of storage buckets that LogScale is aware of. The output
returns the list of known buckets, and a value for the storage used and
managed by LogScale within those buckets.
GET /api/v1/bucket-storage-target
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/bucket-storage-target \
-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/bucket-storage-target \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/bucket-storage-target ^
-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/bucket-storage-target"
Perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN" ;
my $uri = '$YOUR_LOGSCALE_URL/api/v1/bucket-storage-target' ;
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/bucket-storage-target'
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/bucket-storage-target' , (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) [
{
"bucket" : "bucket1" ,
"id" : "1" ,
"keyPrefix" : "logscale/" ,
"provider" : "s3" ,
"readOnly" : false ,
"region" : "us-east-1" ,
"segmentsUsingBucket" : 1277 ,
"uploadedFilesUsingBucket" : 1
}
]
The returned JSON has the following structure:
Table:
Field Type Description bucket string
The name of the storage bucket within the cluster
id integer
The ID of the storage bucket within the cluster
keyPrefix string
The prefix used for...
provider string
The provider for the storage bucket
readOnly boolean
If the storage bucket is read-only
region string
Region annotation for location of the storage bucket
segmentsUsingBucket integer
Number of segments using the storage bucket
uploadedFilesUsingBucket integer
Number of files uploaded using the storage bucket
Update Segments Storage Targets
Change the bucket entity references in all relevant segment entities.
The primary use case for this endpoint is for swapping between bucket
providers in a controlled manner.
POST /api/v1/bucket-storage-target/update-segments-storage-target
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/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID&newStorageTargetId=$NEW_STORAGE_TARGET_ID \
-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/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID&newStorageTargetId=$NEW_STORAGE_TARGET_ID \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID&newStorageTargetId=$NEW_STORAGE_TARGET_ID ^
-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/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID &newStorageTargetId=$NEW_STORAGE_TARGET_ID "
Perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN" ;
my $uri = '$YOUR_LOGSCALE_URL/api/v1/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID&newStorageTargetId=$NEW_STORAGE_TARGET_ID' ;
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/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID&newStorageTargetId=$NEW_STORAGE_TARGET_ID'
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/bucket-storage-target/update-segments-storage-target?oldStorageTargetId=$OLD_STORAGE_TARGET_ID&newStorageTargetId=$NEW_STORAGE_TARGET_ID' ,
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 ();
Delete Bucket Storage Targets
To delete an entry for an unnecessary bucket, use the
DELETE
command, specifying the bucket
number (id from
the returned JSON). The command deletes the bucket entry if
LogScale thinks the bucket no longer contains data that is still
required by the cluster. To delete the bucket forcibly, for example,
when the bucket has been lost, set the
force
parameter to true. Note
that this will result in data loss.
DELETE /api/v1/bucket-storage-target/1
DELETE /api/v1/bucket-storage-target/1?force=true
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/bucket-storage-target \
-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/bucket-storage-target \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/bucket-storage-target ^
-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/bucket-storage-target"
Perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN" ;
my $uri = '$YOUR_LOGSCALE_URL/api/v1/bucket-storage-target' ;
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/bucket-storage-target'
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/bucket-storage-target' , (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);
}