Énumérez toutes les intégrations de logs Datadog/AWS configurées sur votre compte Datadog.
This endpoint requires the aws_configuration_read permission.
"""
List all AWS Logs integrations returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.aws_logs_integration_apiimportAWSLogsIntegrationApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=AWSLogsIntegrationApi(api_client)response=api_instance.list_aws_logs_integrations()print(response)
# List all AWS Logs integrations returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::AWSLogsIntegrationAPI.newpapi_instance.list_aws_logs_integrations()
// List all AWS Logs integrations 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/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewAWSLogsIntegrationApi(apiClient)resp,r,err:=api.ListAWSLogsIntegrations(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AWSLogsIntegrationApi.ListAWSLogsIntegrations`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AWSLogsIntegrationApi.ListAWSLogsIntegrations`:\n%s\n",responseContent)}
// List all AWS Logs integrations returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_aws_logs_integration::AWSLogsIntegrationAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=AWSLogsIntegrationAPI::with_config(configuration);letresp=api.list_aws_logs_integrations().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 all AWS Logs integrations returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);apiInstance.listAWSLogsIntegrations().then((data: v1.AWSLogsListResponse[])=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Associez l’ARN de Lambda créé pour la collecte de logs Datadog/AWS à votre ID de compte AWS pour activer la collecte de logs.
This endpoint requires the aws_configuration_edit permission.
Requête
Body Data (required)
Corps de requête pour l’ajout asynchrone d’ARN de Lambda pour les logs AWS.
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
/**
* Add AWS Log Lambda ARN returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);constparams: v1.AWSLogsIntegrationApiCreateAWSLambdaARNRequest={body:{accountId:"1234567",lambdaArn:"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest",},};apiInstance.createAWSLambdaARN(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Supprimez une configuration de logs Datadog/AWS en supprimant l’ARN de Lambda spécifique associé à un compte AWS donné.
This endpoint requires the aws_configuration_edit permission.
Requête
Body Data (required)
Corps de requête pour la suppression d’un ARN de Lambda AWS.
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 AWS Logs integration returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);constparams: v1.AWSLogsIntegrationApiDeleteAWSLambdaARNRequest={body:{accountId:"1234567",lambdaArn:"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest",},};apiInstance.deleteAWSLambdaARN(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Récupérez la liste des services AWS actuels pour lesquels Datadog propose la collecte automatique des logs. Utilisez les ID de service renvoyés avec le paramètre de services pour l’endpoint d’API Activer la collecte de logs d’un service AWS.
This endpoint requires the aws_configuration_read permission.
"""
Get list of AWS log ready services returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.aws_logs_integration_apiimportAWSLogsIntegrationApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=AWSLogsIntegrationApi(api_client)response=api_instance.list_aws_logs_services()print(response)
# Get list of AWS log ready services returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::AWSLogsIntegrationAPI.newpapi_instance.list_aws_logs_services()
// Get list of AWS log ready services 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/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewAWSLogsIntegrationApi(apiClient)resp,r,err:=api.ListAWSLogsServices(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AWSLogsIntegrationApi.ListAWSLogsServices`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AWSLogsIntegrationApi.ListAWSLogsServices`:\n%s\n",responseContent)}
// Get list of AWS log ready services returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.AwsLogsIntegrationApi;importcom.datadog.api.client.v1.model.AWSLogsListServicesResponse;importjava.util.List;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();AwsLogsIntegrationApiapiInstance=newAwsLogsIntegrationApi(defaultClient);try{List<AWSLogsListServicesResponse>result=apiInstance.listAWSLogsServices();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling AwsLogsIntegrationApi#listAWSLogsServices");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get list of AWS log ready services returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_aws_logs_integration::AWSLogsIntegrationAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=AWSLogsIntegrationAPI::with_config(configuration);letresp=api.list_aws_logs_services().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 list of AWS log ready services returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);apiInstance.listAWSLogsServices().then((data: v1.AWSLogsListServicesResponse[])=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Récupérez la liste des services AWS actuels pour lesquels Datadog propose la collecte automatique des logs. Utilisez les ID de service renvoyés avec le paramètre de services pour l’endpoint d’API Activer la collecte de logs d’un service AWS.
This endpoint requires the aws_configuration_read permission.
Activez la collecte automatique de logs pour une liste de services. Doit être exécuté après CreateAWSLambdaARN pour enregistrer la configuration.
This endpoint requires the aws_configuration_edit permission.
Requête
Body Data (required)
Corps de requête pour l’activation de la collecte de logs de services AWS.
Array of services IDs set to enable automatic log collection. Discover the list of available services with the get list of AWS log ready services API endpoint.
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
/**
* Enable an AWS Logs integration returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);constparams: v1.AWSLogsIntegrationApiEnableAWSLogServicesRequest={body:{accountId:"1234567",services:["s3","elb","elbv2","cloudfront","redshift","lambda"],},};apiInstance.enableAWSLogServices(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Vérifiez si les autorisations nécessaires à l’ajout d’un déclencheur de transmission de logs pour les services et le compte AWS donnés sont définies. L’entrée est la même que pour EnableAWSLogServices. Les appels sont effectués de manière asynchrone, l’endpoint peut donc être interrogé à plusieurs reprises de façon non bloquante jusqu’à ce que la requête asynchrone se termine.
Renvoie un statut created lors de la vérification de la présence des autorisations dans le compte AWS.
Renvoie un statut waiting lors de la vérification.
Renvoie un statut checked and ok si la fonction Lambda existe.
Renvoie un statut error si la fonction Lambda n’existe pas.
This endpoint requires the aws_configuration_read permission.
Requête
Body Data (required)
Corps de requête pour la vérification asynchrone des services qui génèrent des logs.
Array of services IDs set to enable automatic log collection. Discover the list of available services with the get list of AWS log ready services API endpoint.
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
/**
* Check permissions for log services returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);constparams: v1.AWSLogsIntegrationApiCheckAWSLogsServicesAsyncRequest={body:{accountId:"1234567",services:["s3","elb","elbv2","cloudfront","redshift","lambda"],},};apiInstance.checkAWSLogsServicesAsync(params).then((data: v1.AWSLogsAsyncResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Vérifiez si les autorisations nécessaires à l’ajout d’un déclencheur de transmission de logs pour les services et le compte AWS donnés sont définies. L’entrée est la même que pour l’endpoint Activer la collecte de logs d’un service AWS. Les requêtes ultérieures répéteront toujours ce qui précède, les appels de cet endpoint peuvent donc être effectués par intermittence au lieu d’être bloquants.
Renvoie un statut created lors de la vérification de la présence de la fonction Lambda dans le compte.
Renvoie un statut waiting lors de la vérification.
Renvoie un statut checked and ok si la fonction Lambda existe.
Renvoie un statut error si la fonction Lambda n’existe pas.
This endpoint requires the aws_configuration_read permission.
Requête
Body Data (required)
Corps de requête asynchrone pour la vérification de l’existence d’une fonction Lambda.
"""
Check that an AWS Lambda Function exists returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.aws_logs_integration_apiimportAWSLogsIntegrationApifromdatadog_api_client.v1.model.aws_account_and_lambda_requestimportAWSAccountAndLambdaRequestbody=AWSAccountAndLambdaRequest(account_id="1234567",lambda_arn="arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest",)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=AWSLogsIntegrationApi(api_client)response=api_instance.check_aws_logs_lambda_async(body=body)print(response)
# Check that an AWS Lambda Function exists returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::AWSLogsIntegrationAPI.newbody=DatadogAPIClient::V1::AWSAccountAndLambdaRequest.new({account_id:"1234567",lambda_arn:"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest",})papi_instance.check_aws_logs_lambda_async(body)
// Check that an AWS Lambda Function exists 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/datadogV1")funcmain(){body:=datadogV1.AWSAccountAndLambdaRequest{AccountId:"1234567",LambdaArn:"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest",}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewAWSLogsIntegrationApi(apiClient)resp,r,err:=api.CheckAWSLogsLambdaAsync(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AWSLogsIntegrationApi.CheckAWSLogsLambdaAsync`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AWSLogsIntegrationApi.CheckAWSLogsLambdaAsync`:\n%s\n",responseContent)}
// Check that an AWS Lambda Function exists returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.AwsLogsIntegrationApi;importcom.datadog.api.client.v1.model.AWSAccountAndLambdaRequest;importcom.datadog.api.client.v1.model.AWSLogsAsyncResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();AwsLogsIntegrationApiapiInstance=newAwsLogsIntegrationApi(defaultClient);AWSAccountAndLambdaRequestbody=newAWSAccountAndLambdaRequest().accountId("1234567").lambdaArn("arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest");try{AWSLogsAsyncResponseresult=apiInstance.checkAWSLogsLambdaAsync(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling AwsLogsIntegrationApi#checkAWSLogsLambdaAsync");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Check that an AWS Lambda Function exists returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_aws_logs_integration::AWSLogsIntegrationAPI;usedatadog_api_client::datadogV1::model::AWSAccountAndLambdaRequest;#[tokio::main]asyncfnmain(){letbody=AWSAccountAndLambdaRequest::new("1234567".to_string(),"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest".to_string(),);letconfiguration=datadog::Configuration::new();letapi=AWSLogsIntegrationAPI::with_config(configuration);letresp=api.check_aws_logs_lambda_async(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
/**
* Check that an AWS Lambda Function exists returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.AWSLogsIntegrationApi(configuration);constparams: v1.AWSLogsIntegrationApiCheckAWSLogsLambdaAsyncRequest={body:{accountId:"1234567",lambdaArn:"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest",},};apiInstance.checkAWSLogsLambdaAsync(params).then((data: v1.AWSLogsAsyncResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));