Running the CLI command dotnet sitecore cloud environment log download to retrieve a log file of about 4 GB may consume several gigabytes of RAM and end with the error message:
Cannot write more bytes to the buffer than the configured maximum buffer size: 2147483647.
To obtain large log files, use the xmcloud-monitoring-api endpoint instead of the CLI:
https://xmcloud-monitoring-api.sitecorecloud.io/api/logs/v2/[environment-id]/[log-file-name]
>curl -o mylog.txt \ -H "Authorization: Bearer <JWT-token>" \ https://xmcloud-monitoring-api.sitecorecloud.io/api/logs/v2/[environment-id]/[log-file-name]
Log filename can be obtained using "log list" subcommand.
After the download finishes, the log file can be processed locally.
Note: Feature request XS-10119 has been logged to address this limitation in the CLI. For details on tracking the future status of this feature request, refer to KB0853187.