Skip to content

Commit 383040a

Browse files
committed
Update test cloudwatch json
1 parent 956d387 commit 383040a

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"awslogs": {
3+
"data": "H4sIAAAAAAAAAHWPwQqCQBCGX0Xm7EFtK+smZBEUgXoLCdMhFtKV3akI8d0bLYmibvPPN3wz00CJxmQnTO41whwWQRIctmEcB6sQbFC3CjW3XW8kxpOpP+OC22d1Wml1qZkQGtoMsScxaczKN3plG8zlaHIta5KqWsozoTYw3/djzwhpLwivWFGHGpAFe7DL68JlBUk+l7KSN7tCOEJ4M3/qOI49vMHj+zCKdlFqLaU2ZHV2a4Ct/an0/ivdX8oYc1UVX860fQDQiMdxRQEAAA=="
4+
}
5+
}

aws/logs_monitoring/tests/snapshots/cloudwatch_log.json~snapshot

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,46 @@
33
{
44
"path": "/v1/input/abcdefghijklmnopqrstuvwxyz012345",
55
"verb": "POST",
6-
"data": "[{\"message\": \"Error parsing the object. Exception: Event type not supported (see #Event supported section) for event {}\", \"ddsourcecategory\": \"aws\", \"aws\": {\"function_version\": \"$LATEST\", \"invoked_function_arn\": \"arn:aws:lambda:us-east-1:0:function:test\"}, \"ddtags\": \"forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0\"}]"
6+
"data": [
7+
{
8+
"id": "eventId1",
9+
"timestamp": 1440442987000,
10+
"message": "[ERROR] First test message",
11+
"aws": {
12+
"awslogs": {
13+
"logGroup": "testLogGroup",
14+
"logStream": "testLogStream",
15+
"owner": "123456789123"
16+
},
17+
"function_version": "$LATEST",
18+
"invoked_function_arn": "arn:aws:lambda:us-east-1:0:function:test"
19+
},
20+
"ddsourcecategory": "aws",
21+
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0",
22+
"ddsource": "cloudwatch",
23+
"service": "cloudwatch",
24+
"host": "testLogGroup"
25+
},
26+
{
27+
"id": "eventId2",
28+
"timestamp": 1440442987001,
29+
"message": "[ERROR] Second test message",
30+
"aws": {
31+
"awslogs": {
32+
"logGroup": "testLogGroup",
33+
"logStream": "testLogStream",
34+
"owner": "123456789123"
35+
},
36+
"function_version": "$LATEST",
37+
"invoked_function_arn": "arn:aws:lambda:us-east-1:0:function:test"
38+
},
39+
"ddsourcecategory": "aws",
40+
"ddtags": "forwardername:test,forwarder_memorysize:1536,forwarder_version:3.2.0",
41+
"ddsource": "cloudwatch",
42+
"service": "cloudwatch",
43+
"host": "testLogGroup"
44+
}
45+
]
746
}
847
]
948
}

aws/logs_monitoring/tools/test_harness/recorder/recorder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def handle_request(self):
2828
data = None
2929
if self.headers["Content-Length"] != None:
3030
data = self.rfile.read(int(self.headers["Content-Length"])).decode()
31+
# If the input is json, decode it and add to the event directly
32+
try:
33+
data = json.loads(data)
34+
except:
35+
pass
3136

3237
event = {"path": self.path, "verb": self.command, "data": data}
3338
events.append(event)

0 commit comments

Comments
 (0)