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!
Integración de logs de AWS
Configura tu integración de logs de AWS en Datadog directamente a través de la API Datadog.
Para obtener más información, consulta la página de la integración AWS.
Enumera todas las integraciones de logs de AWS en Datadog, configuradas en tu cuenta de 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));
Adjunta el ARN Lambda de la función Lambda creada para la recopilación de logs de AWS en Datadog en tu ID de cuenta de AWS para habilitar la recopilación de logs.
This endpoint requires the aws_configuration_edit permission.
Solicitud
Body Data (required)
Cuerpo de una solicitud de función Lambda asíncrona para logs de 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));
Elimina la configuración de logs de AWS en Datadog eliminando el ARN Lambda específico asociado a una cuenta de AWS determinada.
This endpoint requires the aws_configuration_edit permission.
Solicitud
Body Data (required)
Elimina el cuerpo de una solicitud de ARN Lambda en 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));
Obtén la lista de los servicios AWS actuales a los que Datadog ofrece la recopilación automática de logs. Utiliza los ID de servicios devueltos con el parámetro de servicios para el endpoint de recopilación de logs de servicios 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));
Obtén la lista de los servicios AWS actuales a los que Datadog ofrece la recopilación automática de logs. Utiliza los ID de servicios devueltos con el parámetro de servicios para el endpoint de recopilación de logs de servicios AWS.
This endpoint requires the aws_configuration_read permission.
Habilita la recopilación automática de logs para una lista de servicios. Debe ejecutarse después de la ejecución CreateAWSLambdaARN para guardar la configuración.
This endpoint requires the aws_configuration_edit permission.
Solicitud
Body Data (required)
Habilita el cuerpo de una solicitud de servicios de logs de 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));
Comprueba si existen permisos para añadir activadores de reenvío de logs para servicios determinados y para la cuenta de AWS. La entrada es la misma que para EnableAWSLogServices.
de forma asíncrona, para que pueda ser sondeado repetidamente de forma no bloqueante hasta
que se complete la solicitud asíncrona.
Devuelve el estado “creado” cuando comprueba si existen los permisos
en la cuenta de AWS.
Devuelve el estado “en espera” mientras realiza la comprobación.
Devuelve el estado ‘comprobado y ok’ si existe la función Lambda.
Devuelve el estado “error” si no existe la función Lambda.
This endpoint requires the aws_configuration_read permission.
Solicitud
Body Data (required)
Comprueba el cuerpo de una solicitud de servicios asíncronos para logs de 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
/**
* 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));
Comprueba si existen permisos para añadir activadores de reenvío de logs para servicios determinados y para la cuenta de AWS. La entrada
es la misma que para habilitar la recopilación de servicios AWS. Las solicitudes posteriores siempre repetirán lo anterior, por lo que este
endpoint puede ser sondeado intermitentemente en lugar de bloquearse.
Devuelve el estado “creado” cuando comprueba si la función Lambda existe en la cuenta.
Devuelve el estado “en espera” mientras realiza la comprobación.
Devuelve el estado ‘comprobado y ok’ si existe la función Lambda.
Devuelve el estado “error” si no existe la función Lambda.
This endpoint requires the aws_configuration_read permission.
Solicitud
Body Data (required)
Comprueba el cuerpo de una solicitud de función Lambda asíncrona para logs de AWS.
"""
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));