Skip to content

Commit ee95b3b

Browse files
committed
Increase MAX_EVENT_LEN to match current max
- Use 1MB to allow safety margin
1 parent f1ba23a commit ee95b3b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugins/out_cloudwatch_logs/cloudwatch_api.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,17 @@
4343
/* Maximum number of character limits including both the Attributes key and its value */
4444
#define ATTRIBUTES_MAX_LEN 300
4545

46-
/* 256KiB minus 26 bytes for the event */
47-
#define MAX_EVENT_LEN 262118
46+
/*
47+
* https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
48+
* AWS CloudWatch's documented maximum event size is 1,048,576 bytes (1 MiB),
49+
* including JSON encoding overhead (structure, escaping, etc.).
50+
*
51+
* Setting MAX_EVENT_LEN to 1,000,000 bytes (1 MB) provides a ~4.6% safety margin
52+
* to account for JSON encoding overhead and ensure reliable operation.
53+
* Testing confirmed messages up to 1,048,546 bytes (encoding to 1,048,586 bytes)
54+
* succeed, though we use a conservative limit for production safety.
55+
*/
56+
#define MAX_EVENT_LEN 1000000
4857

4958
/* Prefix used for entity fields only */
5059
#define AWS_ENTITY_PREFIX "aws_entity"

0 commit comments

Comments
 (0)