CloudWatchLogs line length limit
Asked Answered
I

3

10

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.

Impenitent answered 19/6, 2019 at 13:24 Comment(0)
J
4

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.

Jared answered 18/9, 2022 at 6:6 Comment(0)
N
2

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.

Nervous answered 29/6, 2021 at 19:51 Comment(2)
Nice sleuthing! However, a Log Event contains more than just the \@message and \@timestamp field.Impenitent
Those fields are automatically added to the log entry, but the input log event just contains the message and timestamp. I'm assuming the limit is on the input log event.Nervous
S
1

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.

Synaeresis answered 27/1, 2023 at 10:6 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.