Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion aws/logs_monitoring/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
DD_RETRY_KEYWORD,
)


logger = logging.getLogger()
logger.setLevel(logging.getLevelName(os.environ.get("DD_LOG_LEVEL", "INFO").upper()))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"ddsource": "lambda",
"ddsourcecategory": "aws",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.1,env:none",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.2,env:none",
"host": "/aws/lambda/test-lambda-default-log-group",
"id": "37199773595581154154810589279545129148442535997644275712",
"lambda": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"ddsource": "cloudwatch",
"ddsourcecategory": "aws",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.1,test_tag_key:test_tag_value",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.2,test_tag_key:test_tag_value",
"host": "/aws/rds/instance/datadog/postgresql",
"id": "31953106606966983378809025079804211143289615424298221568",
"message": "2021-01-02 03:04:05 UTC::@:[5306]:LOG: database system is ready to accept connections",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"ddsource": "stepfunction",
"ddsourcecategory": "aws",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.1,test_tag_key:test_tag_value,dd_step_functions_trace_enabled:true",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.2,test_tag_key:test_tag_value,dd_step_functions_trace_enabled:true",
"host": "arn:aws:states:us-east-1:12345678910:stateMachine:StepFunction2",
"id": "37199773595581154154810589279545129148442535997644275712",
"message": "{\"id\": \"1\",\"type\": \"ExecutionStarted\",\"details\": {\"input\": \"{}\",\"inputDetails\": {\"truncated\": \"false\"},\"roleArn\": \"arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt\"},\"previous_event_id\": \"0\",\"event_timestamp\": \"1716992192441\",\"execution_arn\": \"arn:aws:states:us-east-1:12345678910:execution:StepFunction2:ccccccc-d1da-4c38-b32c-2b6b07d713fa\",\"redrive_count\": \"0\"}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"ddsource": "stepfunction",
"ddsourcecategory": "aws",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.1,test_tag_key:test_tag_value,dd_step_functions_trace_enabled:true",
"ddtags": "forwardername:function_name,forwarder_memorysize:10,forwarder_version:4.0.2,test_tag_key:test_tag_value,dd_step_functions_trace_enabled:true",
"host": "arn:aws:states:us-east-1:12345678910:stateMachine:StepFunction1",
"id": "37199773595581154154810589279545129148442535997644275712",
"message": "{\"id\": \"1\",\"type\": \"ExecutionStarted\",\"details\": {\"input\": \"{}\",\"inputDetails\": {\"truncated\": \"false\"},\"roleArn\": \"arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt\"},\"previous_event_id\": \"0\",\"event_timestamp\": \"1716992192441\",\"execution_arn\": \"arn:aws:states:us-east-1:12345678910:execution:StepFunction1:ccccccc-d1da-4c38-b32c-2b6b07d713fa\",\"redrive_count\": \"0\"}",
Expand Down

This file was deleted.

64 changes: 48 additions & 16 deletions aws/logs_monitoring/tests/test_awslogs_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ def test_awslogs_handler_rds_postgresql(self, mock_cache_init):
"logStream": "datadog.0",
"logEvents": [
{
"id": "31953106606966983378809025079804211143289615424298221568",
"id": (
"31953106606966983378809025079804211143289615424298221568"
),
"timestamp": 1609556645000,
"message": "2021-01-02 03:04:05 UTC::@:[5306]:LOG: database system is ready to accept connections",
"message": (
"2021-01-02 03:04:05 UTC::@:[5306]:LOG: database system is ready to accept connections"
),
}
],
}
Expand Down Expand Up @@ -90,14 +94,22 @@ def test_awslogs_handler_step_functions_tags_added_properly(
{
"messageType": "DATA_MESSAGE",
"owner": "425362996713",
"logGroup": "/aws/vendedlogs/states/logs-to-traces-sequential-Logs",
"logStream": "states/logs-to-traces-sequential/2022-11-10-15-50/7851b2d9",
"logGroup": (
"/aws/vendedlogs/states/logs-to-traces-sequential-Logs"
),
"logStream": (
"states/logs-to-traces-sequential/2022-11-10-15-50/7851b2d9"
),
"subscriptionFilters": ["testFilter"],
"logEvents": [
{
"id": "37199773595581154154810589279545129148442535997644275712",
"id": (
"37199773595581154154810589279545129148442535997644275712"
),
"timestamp": 1668095539607,
"message": '{"id": "1","type": "ExecutionStarted","details": {"input": "{}","inputDetails": {"truncated": "false"},"roleArn": "arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt"},"previous_event_id": "0","event_timestamp": "1716992192441","execution_arn": "arn:aws:states:us-east-1:12345678910:execution:StepFunction1:ccccccc-d1da-4c38-b32c-2b6b07d713fa","redrive_count": "0"}',
"message": (
'{"id": "1","type": "ExecutionStarted","details": {"input": "{}","inputDetails": {"truncated": "false"},"roleArn": "arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt"},"previous_event_id": "0","event_timestamp": "1716992192441","execution_arn": "arn:aws:states:us-east-1:12345678910:execution:StepFunction1:ccccccc-d1da-4c38-b32c-2b6b07d713fa","redrive_count": "0"}'
),
}
],
}
Expand Down Expand Up @@ -139,13 +151,19 @@ def test_awslogs_handler_step_functions_customized_log_group(
"messageType": "DATA_MESSAGE",
"owner": "425362996713",
"logGroup": "test/logs",
"logStream": "states/logs-to-traces-sequential/2022-11-10-15-50/7851b2d9",
"logStream": (
"states/logs-to-traces-sequential/2022-11-10-15-50/7851b2d9"
),
"subscriptionFilters": ["testFilter"],
"logEvents": [
{
"id": "37199773595581154154810589279545129148442535997644275712",
"id": (
"37199773595581154154810589279545129148442535997644275712"
),
"timestamp": 1668095539607,
"message": '{"id": "1","type": "ExecutionStarted","details": {"input": "{}","inputDetails": {"truncated": "false"},"roleArn": "arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt"},"previous_event_id": "0","event_timestamp": "1716992192441","execution_arn": "arn:aws:states:us-east-1:12345678910:execution:StepFunction2:ccccccc-d1da-4c38-b32c-2b6b07d713fa","redrive_count": "0"}',
"message": (
'{"id": "1","type": "ExecutionStarted","details": {"input": "{}","inputDetails": {"truncated": "false"},"roleArn": "arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt"},"previous_event_id": "0","event_timestamp": "1716992192441","execution_arn": "arn:aws:states:us-east-1:12345678910:execution:StepFunction2:ccccccc-d1da-4c38-b32c-2b6b07d713fa","redrive_count": "0"}'
),
}
],
}
Expand Down Expand Up @@ -179,14 +197,22 @@ def test_awslogs_handler_lambda_log(self):
{
"messageType": "DATA_MESSAGE",
"owner": "123456789012",
"logGroup": "/aws/lambda/test-lambda-default-log-group",
"logStream": "2023/11/06/[$LATEST]b25b1f977b3e416faa45a00f427e7acb",
"logGroup": (
"/aws/lambda/test-lambda-default-log-group"
),
"logStream": (
"2023/11/06/[$LATEST]b25b1f977b3e416faa45a00f427e7acb"
),
"subscriptionFilters": ["testFilter"],
"logEvents": [
{
"id": "37199773595581154154810589279545129148442535997644275712",
"id": (
"37199773595581154154810589279545129148442535997644275712"
),
"timestamp": 1668095539607,
"message": "2021-01-02 03:04:05 UTC::@:[5306]:LOG: database system is ready to accept connections",
"message": (
"2021-01-02 03:04:05 UTC::@:[5306]:LOG: database system is ready to accept connections"
),
}
],
}
Expand Down Expand Up @@ -326,7 +352,9 @@ def test_get_state_machine_arn(self):
{
"message": json.dumps(
{
"execution_arn": "arn:aws:states:sa-east-1:425362996713:express:my-Various-States:7f653fda-c79a-430b-91e2-3f97eb87cabb:862e5d40-a457-4ca2-a3c1-78485bd94d3f"
"execution_arn": (
"arn:aws:states:sa-east-1:425362996713:express:my-Various-States:7f653fda-c79a-430b-91e2-3f97eb87cabb:862e5d40-a457-4ca2-a3c1-78485bd94d3f"
)
}
),
}
Expand All @@ -342,7 +370,9 @@ def test_get_state_machine_arn(self):
{
"message": json.dumps(
{
"execution_arn": "arn:aws:states:sa-east-1:425362996713:express:my-Various-States/7f653fda-c79a-430b-91e2-3f97eb87cabb:862e5d40-a457-4ca2-a3c1-78485bd94d3f"
"execution_arn": (
"arn:aws:states:sa-east-1:425362996713:express:my-Various-States/7f653fda-c79a-430b-91e2-3f97eb87cabb:862e5d40-a457-4ca2-a3c1-78485bd94d3f"
)
}
)
}
Expand All @@ -359,7 +389,9 @@ def test_get_state_machine_arn(self):
{
"message": json.dumps(
{
"execution_arn": "arn:aws:states:sa-east-1:425362996713:express:my-Various-States\\7f653fda-c79a-430b-91e2-3f97eb87cabb:862e5d40-a457-4ca2-a3c1-78485bd94d3f"
"execution_arn": (
"arn:aws:states:sa-east-1:425362996713:express:my-Various-States\\7f653fda-c79a-430b-91e2-3f97eb87cabb:862e5d40-a457-4ca2-a3c1-78485bd94d3f"
)
}
)
}
Expand Down
8 changes: 6 additions & 2 deletions aws/logs_monitoring/tests/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ def test_generate_custom_tags_cache(self):
{
"ResourceTagMappingList": [
{
"ResourceARN": "arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda-dev",
"ResourceARN": (
"arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda-dev"
),
"Tags": [
{"Key": "stage", "Value": "dev"},
{"Key": "team", "Value": "serverless"},
{"Key": "empty", "Value": ""},
],
},
{
"ResourceARN": "arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda-prod",
"ResourceARN": (
"arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda-prod"
),
"Tags": [
{"Key": "stage", "Value": "prod"},
{"Key": "team", "Value": "serverless"},
Expand Down
16 changes: 12 additions & 4 deletions aws/logs_monitoring/tests/test_cloudtrail_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ class Context:
"userIdentity": {
"type": "AssumedRole",
"principalId": "AROAYYB64AB3HGPQO2EPR:DatadogAWSIntegration",
"arn": "arn:aws:sts::601427279990:assumed-role/Siti_DatadogAWSIntegrationRole/i-08014e4f62ccf762d",
"arn": (
"arn:aws:sts::601427279990:assumed-role/Siti_DatadogAWSIntegrationRole/i-08014e4f62ccf762d"
),
"accountId": "601427279990",
"accessKeyId": "ASIAYYB64AB3DWOY7JNT",
"sessionContext": {
"sessionIssuer": {
"type": "Role",
"principalId": "AROAYYB64AB3HGPQO2EPR",
"arn": "arn:aws:iam::601427279990:role/Siti_DatadogAWSIntegrationRole",
"arn": (
"arn:aws:iam::601427279990:role/Siti_DatadogAWSIntegrationRole"
),
"accountId": "601427279990",
"userName": "Siti_DatadogAWSIntegrationRole",
},
Expand All @@ -75,7 +79,9 @@ class Context:
{
"accountId": "601427279990",
"type": "AWS::DynamoDB::Table",
"ARN": "arn:aws:dynamodb:us-east-1:601427279990:table/KinesisClientLibraryLocal",
"ARN": (
"arn:aws:dynamodb:us-east-1:601427279990:table/KinesisClientLibraryLocal"
),
}
],
"eventType": "AwsApiCall",
Expand Down Expand Up @@ -114,7 +120,9 @@ def test_s3_cloudtrail_pasing_and_enrichment(
"name": "test-bucket",
},
"object": {
"key": "601427279990_CloudTrail_us-east-1_20210503T0000Z_QrttGEk4ZcBTLwj5.json.gz"
"key": (
"601427279990_CloudTrail_us-east-1_20210503T0000Z_QrttGEk4ZcBTLwj5.json.gz"
)
},
}
}
Expand Down
Loading
Loading