Grail - Storage Management
Overview Dynatrace Bucket Management API for Grail
This API allows you to manage storage for Grail. Data is organizied in buckets. To get familiar with the data model within Grail check the Grail data model documentation.
Access Management
Entpoint permissions
There are 4 permissions that are enabling the management of the Grail bucket storage. More about Grail storage permissions can be read in the documentation.
-
storage:bucket-definitions:read
-
storage:bucket-definitions:write
-
storage:bucket-definitions:delete
-
storage:bucket-definitions:truncate
Storage Object Modification
Optimistic Locking Version
Operations which modify buckets use mandatory optimistic locking. When such operations are executed, the user must provide the version upon which they operate. The version can be found in the JSON within the response of GET bucket definitions or GET bucket definition.
If the document version in the service doesn't match, because the document has been modified in the meantime, then the operation gets rejected.
Storage Object creation
Creating a custom storage bucket can have benefits in terms of data management. Read more about custom buckets.
Bucket creation can take up to 1 minute.
To create a new custom Grail bucket with Storage Management you need to specify:
- A unique bucket name
- It has to be between 3-100 characters long and start with a letter.
- The bucket name can only contain
- lowercase alphanumeric characters [ a - z ]
- underscores [ _ ] and
- hyphens [ - ].
- Bucket name can not start with
- default_
- dt_.
The bucket name can't be edited or changed at a later time.
-
Display name. You can use this field to describe your bucket.
-
Retention period in days between 1 day - 3657 days (10 years).
npm install @dynatrace-sdk/client-bucket-management
bucketDefinitionsClient
import { bucketDefinitionsClient } from '@dynatrace-sdk/client-bucket-management';
createBucket
Create a new bucket
Create a new custom bucket.
Bucket creation can take up to 1 minute.
Required permission: storage:bucket-definitions:write
To create a new custom Grail bucket with Storage Management you need to specify the following values:
Allowed JSON values
-
bucketName defines the name of the bucket. The bucket name can't be edited or changed at a later time.
-
must be unique
-
has to be between 3-100 characters long and has to start with a letter
-
can only contain
-
lowercase alphanumeric characters [ a - z ]
-
underscores [ _ ] and
-
hyphens [ - ].
-
-
must not start with
-
default_
-
dt_
-
-
-
table name of the table this bucket is assigned to. Currently allowed one of [logs, events, bizevents].
-
retentionDays describes the data retention period in days between 1 day - 3657 days (10 years + 1 week).
-
displayName Optional field that can be used to describe the bucket. Length of the field is limited to 200 characters.
Parameters
Name | Type |
---|---|
config.body*required | CreateBucket |
Returns
Return type | Status code | Description |
---|---|---|
Bucket | 201 | Successfully created bucket definition |
Throws
Error Type | Error Message |
---|---|
ErrorEnvelopeError | bad request | unauthorized | missing permissions | Bucket already exists |
Code example
import { bucketDefinitionsClient } from "@dynatrace-sdk/client-bucket-management";
const data = await bucketDefinitionsClient.createBucket({
body: {
bucketName: "custom_logs",
table: "logs",
displayName: "Custom logs bucket",
retentionDays: 35,
includedQueryLimitDays: 0,
},
});
deleteBucket
Delete a bucket
ATTENTION - This operation is irreversible
Delete can be used to delete a bucket. This operation will remove the content of a given bucket and then delete the bucket itself.
Delete is an asynchronous task. Runtime will depend on the amount of data that has to be removed.
The status of this operation can be tracked via the status field within the [GET bucket definitions] (#operations-Bucket_Definitions-getDefinitions) or GET bucket definition. Status will show deleting as long as data will be drained and finally the bucket will be deleted. Afterwards the bucket will cease to exist.
Operation can be executed on all types of buckets except buckets where bucketName starts with dt_ or default_.
Before a bucket is deleted, checks are performed to verify that the bucket is not in use.
Required permission: storage:bucket-definitions:delete
Parameters
Name | Type | Description |
---|---|---|
config.bucketName*required | string | Bucket name to delete. |