Skip to main content

archives

Creates, updates, deletes, gets or lists an archives resource.

Overview

Namearchives
TypeResource
Iddatadog.logs.archives

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe archive ID. (example: a2zcMylnM4OCHpYusxIi3g)
attributesobjectThe attributes associated with the archive.
typestringThe type of the resource. The value should always be archives. (default: archives, example: archives)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_logs_archiveselectarchive_idGet a specific archive from your organization.
list_logs_archivesselectGet the list of configured logs archives with their definitions.
create_logs_archiveinsertCreate an archive in your organization.
update_logs_archivereplacearchive_idUpdate a given archive configuration.<br /><br />Note: Using this method updates your archive configuration by replacing<br />your current configuration with the new one sent to your Datadog organization.
delete_logs_archivedeletearchive_idDelete a given archive from your organization.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
archive_idstringThe ID of the archive.
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.

SELECT examples

Get a specific archive from your organization.

SELECT
id,
attributes,
type
FROM datadog.logs.archives
WHERE archive_id = '{{ archive_id }}' -- required
;

INSERT examples

Create an archive in your organization.

INSERT INTO datadog.logs.archives (
data
)
SELECT
'{{ data }}'
RETURNING
data
;

REPLACE examples

Update a given archive configuration.<br /><br />Note: Using this method updates your archive configuration by replacing<br />your current configuration with the new one sent to your Datadog organization.

REPLACE datadog.logs.archives
SET
data = '{{ data }}'
WHERE
archive_id = '{{ archive_id }}' --required
RETURNING
data;

DELETE examples

Delete a given archive from your organization.

DELETE FROM datadog.logs.archives
WHERE archive_id = '{{ archive_id }}' --required
;