Titulum
Titulum

Reputation: 11476

CloudWatchLogs line length limit

I was wondering if CLoudWatchLogs has a limit on the length of 1 line of logging. I checked the CloudWatchLogs Limit documentation page, but they do not specify anything regarding line length limit.

They do mention the Event size limit (256 KB) , which is the maximum size of 1 event, but that does not tell me anything about the length of the line. A log event can contain more information than only the @message field.

Upvotes: 10

Views: 10009

Answers (3)

gileri
gileri

Reputation: 768

The maximum event size is ~256kB, events longer than that will fail (they are not truncated). This size includes 26 bytes of metadata (10 bytes of timestamp and 16 of field names).

This can be verified with this boto3 script.

Upvotes: 2

Bratadip Palai
Bratadip Palai

Reputation: 51

I tried to console.log a big file( around 800 KB), in cloudwatch I can see 4 console.log message first 3 with around 250 KB size, and rest in the last. So from my experience line numbers do not matter only the total size of each event matters.

Upvotes: 4

Tim Ludwinski
Tim Ludwinski

Reputation: 2863

Looking into this a bit (since I was curious about the same thing). The boto3 python client documentation refers to log lines as events. The event consists of the timestamp and the message. Within various AWS tools, the message can be broken into various fields, but I believe the timestamp and message are the only actual fields in the log event.

So this would suggest that about 256K is the maximum size for each line (minus the size of the timestamp and probably some overhead as well).

This is not to say that the AWS web console will handle lines that long well though.

Upvotes: 2

Related Questions