- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
AWS service logs can be collected with the Datadog Forwarder Lambda function. This Lambda—which triggers on S3 Buckets, CloudWatch log groups, and EventBridge events—forwards logs to Datadog.
To start collecting logs from your AWS services:
Note: If you are in the AWS us-east-1
region, leverage Datadog-AWS Private Link.
Note: Cloudformation creates an IAM policy which includes KMS:Decrypt for all resources, and does not align with AWS Security Hub’s best practice. This permission is used is to decrypt objects from KMS-encrypted S3 buckets to set up Lambda function, and which KMS key is used to encrypt the S3 buckets cannot be predicted. You can safely delete this permission after the installation successfully finished.
Any AWS service that generates logs into a S3 bucket or a CloudWatch Log Group is supported. Find setup instructions for the most used services in the table below:
There are two options when configuring triggers on the Datadog Forwarder Lambda function:
Datadog can automatically configure triggers on the Datadog Forwarder Lambda function to collect AWS logs from the following sources and locations:
Source | Location |
---|---|
API Gateway Access Logs | CloudWatch |
API Gateway Execution Logs | CloudWatch |
Application ELB Access Logs | S3 |
Classic ELB Access Logs | S3 |
CloudFront Access Logs | S3 |
Lambda Logs | CloudWatch |
Redshift Logs | S3 |
S3 Access Logs | S3 |
Step Functions | CloudWatch |
Web Application Firewall | S3, CloudWatch |
Note: Subscription filters are not created automatically by the DatadogForwarder. Create them directly on a Log Group.
If you haven’t already, set up the Datadog log collection AWS Lambda function.
Ensure the policy of the IAM role used for Datadog-AWS integration has the following permissions. Information on how these permissions are used can be found in the descriptions below:
"cloudfront:GetDistributionConfig",
"cloudfront:ListDistributions",
"elasticloadbalancing:DescribeLoadBalancers",
"elasticloadbalancing:DescribeLoadBalancerAttributes",
"lambda:List*",
"lambda:GetPolicy",
"redshift:DescribeClusters",
"redshift:DescribeLoggingStatus",
"s3:GetBucketLogging",
"s3:GetBucketLocation",
"s3:GetBucketNotification",
"s3:ListAllMyBuckets",
"s3:PutBucketNotification",
"states:ListStateMachines",
"states:DescribeStateMachine",
"wafv2:ListLoggingConfigurations",
"logs:PutSubscriptionFilter",
"logs:DeleteSubscriptionFilter",
"logs:DescribeSubscriptionFilters"
AWS Permission | Description |
---|---|
cloudfront:GetDistributionConfig | Get the name of the S3 bucket containing CloudFront access logs. |
cloudfront:ListDistributions | List all CloudFront distributions. |
elasticloadbalancing: DescribeLoadBalancers | List all load balancers. |
elasticloadbalancing: DescribeLoadBalancerAttributes | Get the name of the S3 bucket containing ELB access logs. |
lambda:List* | List all Lambda functions. |
lambda:GetPolicy | Gets the Lambda policy when triggers are to be removed. |
redshift:DescribeClusters | List all Redshift clusters. |
redshift:DescribeLoggingStatus | Get the name of the S3 bucket containing Redshift Logs. |
s3:GetBucketLogging | Get the name of the S3 bucket containing S3 access logs. |
s3:GetBucketLocation | Get the region of the S3 bucket containing S3 access logs. |
s3:GetBucketNotification | Get existing Lambda trigger configurations. |
s3:ListAllMyBuckets | List all S3 buckets. |
s3:PutBucketNotification | Add or remove a Lambda trigger based on S3 bucket events. |
states:ListStateMachines | List all Step Functions. |
states:DescribeStateMachine | Get logging details about a Step Function. |
wafv2:ListLoggingConfigurations | Lists all logging configurations of the Web Application Firewall. |
logs:PutSubscriptionFilter | Add a Lambda trigger based on CloudWatch Log events |
logs:DeleteSubscriptionFilter | Remove a Lambda trigger based on CloudWatch Log events |
logs:DescribeSubscriptionFilters | Lists the subscription filters for the specified log group. |
In the AWS Integration page, select the AWS Account to collect logs from and click on the Log Collection tab.
Enter the ARN of the Lambda created in the previous section and click Add.
Select the services from which you’d like to collect logs and click Save. To stop collecting logs from a particular service, deselect the log source.
If you have logs across multiple regions, you must create additional Lambda functions in those regions and enter them in this page.
To stop collecting all AWS logs, hover over a Lambda and click the Delete icon. All triggers for that function are removed.
Within a few minutes of this initial setup, your AWS Logs appear in the Datadog Log Explorer.
If you are collecting logs from a CloudWatch log group, configure the trigger to the Datadog Forwarder Lambda function using one of the following methods:
For Terraform users, you can provision and manage your triggers using the aws_cloudwatch_log_subscription_filter resource. See sample code below.
resource "aws_cloudwatch_log_subscription_filter" "datadog_log_subscription_filter" {
name = "datadog_log_subscription_filter"
log_group_name = <CLOUDWATCH_LOG_GROUP_NAME> # for example, /aws/lambda/my_lambda_name
destination_arn = <DATADOG_FORWARDER_ARN> # for example, arn:aws:lambda:us-east-1:123:function:datadog-forwarder
filter_pattern = ""
}
For AWS CloudFormation users, you can provision and manage your triggers using the CloudFormation AWS::Logs::SubscriptionFilter resource. See sample code below.
The sample code also work for AWS SAM and Serverless Framework. For Serverless Framework, put the code under the resources section within your serverless.yml
.
Resources:
MyLogSubscriptionFilter:
Type: "AWS::Logs::SubscriptionFilter"
Properties:
DestinationArn: "<DATADOG_FORWARDER_ARN>"
LogGroupName: "<CLOUDWATCH_LOG_GROUP_NAME>"
FilterPattern: ""
If you are collecting logs from an S3 bucket, configure the trigger to the Datadog Forwarder Lambda function using one of the following methods:
Once the Lambda function is installed, manually add a trigger on the S3 bucket that contains your logs in the AWS console:
Select the bucket and then follow the AWS instructions:
Set the correct event type on S3 buckets:
Once done, go into your Datadog Log section to start exploring your logs!
For Terraform users, you can provision and manage your triggers using the aws_s3_bucket_notification resource. See the sample code below.
resource "aws_s3_bucket_notification" "my_bucket_notification" {
bucket = my_bucket
lambda_function {
lambda_function_arn = "<DATADOG_FORWARDER_ARN>"
events = ["s3:ObjectCreated:*"]
filter_prefix = "AWSLogs/"
filter_suffix = ".log"
}
}
For CloudFormation users, you can configure triggers using the CloudFormation NotificationConfiguration for your S3 bucket. See the sample code below.
Resources:
Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: "<MY_BUCKET>"
NotificationConfiguration:
LambdaConfigurations:
- Event: 's3:ObjectCreated:*'
Function: "<DATADOG_FORWARDER_ARN>"
You can scrub emails or IP address from logs sent by the Lambda function, or define a custom scrubbing rule in the Lambda parameters. You can also exclude or send only those logs that match a specific pattern by using the filtering option.