This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
Logs Archives
Archives forward all the logs ingested to a cloud storage system.
See the Archives Page
for a list of the archives currently configured in Datadog.
You need an API and non-scoped application key with Admin rights to interact with these endpoints.
"""
Get all archives returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_archives_apiimportLogsArchivesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsArchivesApi(api_client)response=api_instance.list_logs_archives()print(response)
# Get all archives returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsArchivesAPI.newpapi_instance.list_logs_archives()
// Get all archives returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsArchivesApi(apiClient)resp,r,err:=api.ListLogsArchives(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsArchivesApi.ListLogsArchives`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `LogsArchivesApi.ListLogsArchives`:\n%s\n",responseContent)}
// Get all archives returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.LogsArchivesApi;importcom.datadog.api.client.v2.model.LogsArchives;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();LogsArchivesApiapiInstance=newLogsArchivesApi(defaultClient);try{LogsArchivesresult=apiInstance.listLogsArchives();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling LogsArchivesApi#listLogsArchives");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get all archives returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_archives::LogsArchivesAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=LogsArchivesAPI::with_config(configuration);letresp=api.list_logs_archives().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Get all archives returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);apiInstance.listLogsArchives().then((data: v2.LogsArchives)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Create an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiCreateLogsArchiveRequest={body:{data:{attributes:{destination:{container:"container-name",integration:{clientId:"aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa",tenantId:"aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa",},storageAccount:"account-name",type:"azure",},includeTags: false,name:"Nginx Archive",query:"source:nginx",rehydrationMaxScanSizeInGb: 100,rehydrationTags:["team:intake","team:app"],},type:"archives",},},};apiInstance.createLogsArchive(params).then((data: v2.LogsArchive)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Get an archive returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_archives_apiimportLogsArchivesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsArchivesApi(api_client)response=api_instance.get_logs_archive(archive_id="archive_id",)print(response)
# Get an archive returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsArchivesAPI.newpapi_instance.get_logs_archive("archive_id")
// Get an archive returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsArchivesApi(apiClient)resp,r,err:=api.GetLogsArchive(ctx,"archive_id")iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsArchivesApi.GetLogsArchive`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `LogsArchivesApi.GetLogsArchive`:\n%s\n",responseContent)}
// Get an archive returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.LogsArchivesApi;importcom.datadog.api.client.v2.model.LogsArchive;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();LogsArchivesApiapiInstance=newLogsArchivesApi(defaultClient);try{LogsArchiveresult=apiInstance.getLogsArchive("archive_id");System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling LogsArchivesApi#getLogsArchive");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get an archive returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_archives::LogsArchivesAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=LogsArchivesAPI::with_config(configuration);letresp=api.get_logs_archive("archive_id".to_string()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Get an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiGetLogsArchiveRequest={archiveId:"archive_id",};apiInstance.getLogsArchive(params).then((data: v2.LogsArchive)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Update an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiUpdateLogsArchiveRequest={body:{data:{attributes:{destination:{container:"container-name",integration:{clientId:"aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa",tenantId:"aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa",},storageAccount:"account-name",type:"azure",},includeTags: false,name:"Nginx Archive",query:"source:nginx",rehydrationMaxScanSizeInGb: 100,rehydrationTags:["team:intake","team:app"],},type:"archives",},},archiveId:"archive_id",};apiInstance.updateLogsArchive(params).then((data: v2.LogsArchive)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Delete an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiDeleteLogsArchiveRequest={archiveId:"archive_id",};apiInstance.deleteLogsArchive(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
List read roles for an archive returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_archives_apiimportLogsArchivesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsArchivesApi(api_client)response=api_instance.list_archive_read_roles(archive_id="archive_id",)print(response)
# List read roles for an archive returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsArchivesAPI.newpapi_instance.list_archive_read_roles("archive_id")
// List read roles for an archive returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsArchivesApi(apiClient)resp,r,err:=api.ListArchiveReadRoles(ctx,"archive_id")iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsArchivesApi.ListArchiveReadRoles`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `LogsArchivesApi.ListArchiveReadRoles`:\n%s\n",responseContent)}
// List read roles for an archive returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.LogsArchivesApi;importcom.datadog.api.client.v2.model.RolesResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();LogsArchivesApiapiInstance=newLogsArchivesApi(defaultClient);try{RolesResponseresult=apiInstance.listArchiveReadRoles("archive_id");System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling LogsArchivesApi#listArchiveReadRoles");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// List read roles for an archive returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_archives::LogsArchivesAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=LogsArchivesAPI::with_config(configuration);letresp=api.list_archive_read_roles("archive_id".to_string()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* List read roles for an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiListArchiveReadRolesRequest={archiveId:"archive_id",};apiInstance.listArchiveReadRoles(params).then((data: v2.RolesResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Grant role to an archive returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_archives_apiimportLogsArchivesApifromdatadog_api_client.v2.model.relationship_to_roleimportRelationshipToRolefromdatadog_api_client.v2.model.relationship_to_role_dataimportRelationshipToRoleDatafromdatadog_api_client.v2.model.roles_typeimportRolesTypebody=RelationshipToRole(data=RelationshipToRoleData(id="3653d3c6-0c75-11ea-ad28-fb5701eabc7d",type=RolesType.ROLES,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsArchivesApi(api_client)api_instance.add_read_role_to_archive(archive_id="archive_id",body=body)
# Grant role to an archive returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsArchivesAPI.newbody=DatadogAPIClient::V2::RelationshipToRole.new({data:DatadogAPIClient::V2::RelationshipToRoleData.new({id:"3653d3c6-0c75-11ea-ad28-fb5701eabc7d",type:DatadogAPIClient::V2::RolesType::ROLES,}),})api_instance.add_read_role_to_archive("archive_id",body)
// Grant role to an archive returns "OK" response
packagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.RelationshipToRole{Data:&datadogV2.RelationshipToRoleData{Id:datadog.PtrString("3653d3c6-0c75-11ea-ad28-fb5701eabc7d"),Type:datadogV2.ROLESTYPE_ROLES.Ptr(),},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsArchivesApi(apiClient)r,err:=api.AddReadRoleToArchive(ctx,"archive_id",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsArchivesApi.AddReadRoleToArchive`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Grant role to an archive returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.LogsArchivesApi;importcom.datadog.api.client.v2.model.RelationshipToRole;importcom.datadog.api.client.v2.model.RelationshipToRoleData;importcom.datadog.api.client.v2.model.RolesType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();LogsArchivesApiapiInstance=newLogsArchivesApi(defaultClient);RelationshipToRolebody=newRelationshipToRole().data(newRelationshipToRoleData().id("3653d3c6-0c75-11ea-ad28-fb5701eabc7d").type(RolesType.ROLES));try{apiInstance.addReadRoleToArchive("archive_id",body);}catch(ApiExceptione){System.err.println("Exception when calling LogsArchivesApi#addReadRoleToArchive");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Grant role to an archive returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_archives::LogsArchivesAPI;usedatadog_api_client::datadogV2::model::RelationshipToRole;usedatadog_api_client::datadogV2::model::RelationshipToRoleData;usedatadog_api_client::datadogV2::model::RolesType;#[tokio::main]asyncfnmain(){letbody=RelationshipToRole::new().data(RelationshipToRoleData::new().id("3653d3c6-0c75-11ea-ad28-fb5701eabc7d".to_string()).type_(RolesType::ROLES),);letconfiguration=datadog::Configuration::new();letapi=LogsArchivesAPI::with_config(configuration);letresp=api.add_read_role_to_archive("archive_id".to_string(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Grant role to an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiAddReadRoleToArchiveRequest={body:{data:{id:"3653d3c6-0c75-11ea-ad28-fb5701eabc7d",type:"roles",},},archiveId:"archive_id",};apiInstance.addReadRoleToArchive(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Revoke role from an archive returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_archives_apiimportLogsArchivesApifromdatadog_api_client.v2.model.relationship_to_roleimportRelationshipToRolefromdatadog_api_client.v2.model.relationship_to_role_dataimportRelationshipToRoleDatafromdatadog_api_client.v2.model.roles_typeimportRolesTypebody=RelationshipToRole(data=RelationshipToRoleData(id="3653d3c6-0c75-11ea-ad28-fb5701eabc7d",type=RolesType.ROLES,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsArchivesApi(api_client)api_instance.remove_role_from_archive(archive_id="archive_id",body=body)
# Revoke role from an archive returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsArchivesAPI.newbody=DatadogAPIClient::V2::RelationshipToRole.new({data:DatadogAPIClient::V2::RelationshipToRoleData.new({id:"3653d3c6-0c75-11ea-ad28-fb5701eabc7d",type:DatadogAPIClient::V2::RolesType::ROLES,}),})api_instance.remove_role_from_archive("archive_id",body)
// Revoke role from an archive returns "OK" response
packagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.RelationshipToRole{Data:&datadogV2.RelationshipToRoleData{Id:datadog.PtrString("3653d3c6-0c75-11ea-ad28-fb5701eabc7d"),Type:datadogV2.ROLESTYPE_ROLES.Ptr(),},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsArchivesApi(apiClient)r,err:=api.RemoveRoleFromArchive(ctx,"archive_id",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsArchivesApi.RemoveRoleFromArchive`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Revoke role from an archive returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.LogsArchivesApi;importcom.datadog.api.client.v2.model.RelationshipToRole;importcom.datadog.api.client.v2.model.RelationshipToRoleData;importcom.datadog.api.client.v2.model.RolesType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();LogsArchivesApiapiInstance=newLogsArchivesApi(defaultClient);RelationshipToRolebody=newRelationshipToRole().data(newRelationshipToRoleData().id("3653d3c6-0c75-11ea-ad28-fb5701eabc7d").type(RolesType.ROLES));try{apiInstance.removeRoleFromArchive("archive_id",body);}catch(ApiExceptione){System.err.println("Exception when calling LogsArchivesApi#removeRoleFromArchive");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Revoke role from an archive returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_archives::LogsArchivesAPI;usedatadog_api_client::datadogV2::model::RelationshipToRole;usedatadog_api_client::datadogV2::model::RelationshipToRoleData;usedatadog_api_client::datadogV2::model::RolesType;#[tokio::main]asyncfnmain(){letbody=RelationshipToRole::new().data(RelationshipToRoleData::new().id("3653d3c6-0c75-11ea-ad28-fb5701eabc7d".to_string()).type_(RolesType::ROLES),);letconfiguration=datadog::Configuration::new();letapi=LogsArchivesAPI::with_config(configuration);letresp=api.remove_role_from_archive("archive_id".to_string(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Revoke role from an archive returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiRemoveRoleFromArchiveRequest={body:{data:{id:"3653d3c6-0c75-11ea-ad28-fb5701eabc7d",type:"roles",},},archiveId:"archive_id",};apiInstance.removeRoleFromArchive(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Get archive order returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_archives_apiimportLogsArchivesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsArchivesApi(api_client)response=api_instance.get_logs_archive_order()print(response)
# Get archive order returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsArchivesAPI.newpapi_instance.get_logs_archive_order()
// Get archive order returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsArchivesApi(apiClient)resp,r,err:=api.GetLogsArchiveOrder(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsArchivesApi.GetLogsArchiveOrder`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `LogsArchivesApi.GetLogsArchiveOrder`:\n%s\n",responseContent)}
// Get archive order returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.LogsArchivesApi;importcom.datadog.api.client.v2.model.LogsArchiveOrder;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();LogsArchivesApiapiInstance=newLogsArchivesApi(defaultClient);try{LogsArchiveOrderresult=apiInstance.getLogsArchiveOrder();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling LogsArchivesApi#getLogsArchiveOrder");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get archive order returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_archives::LogsArchivesAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=LogsArchivesAPI::with_config(configuration);letresp=api.get_logs_archive_order().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Get archive order returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);apiInstance.getLogsArchiveOrder().then((data: v2.LogsArchiveOrder)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Update the order of your archives. Since logs are processed sequentially, reordering an archive may change
the structure and content of the data processed by other archives.
Note: Using the PUT method updates your archive’s order by replacing the current order
with the new one.
This endpoint requires the logs_write_archives permission.
Solicitud
Body Data (required)
An object containing the new ordered list of archive IDs.
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Update archive order returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsArchivesApi(configuration);constparams: v2.LogsArchivesApiUpdateLogsArchiveOrderRequest={body:{data:{attributes:{archiveIds:["a2zcMylnM4OCHpYusxIi1g","a2zcMylnM4OCHpYusxIi2g","a2zcMylnM4OCHpYusxIi3g",],},type:"archive_order",},},};apiInstance.updateLogsArchiveOrder(params).then((data: v2.LogsArchiveOrder)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));