cwh icon indicating copy to clipboard operation
cwh copied to clipboard

Getting error: The batch of log events in a single PutLogEvents request cannot span more than 24 hours

Open webkod3r opened this issue 3 years ago • 2 comments

Lumen version: 5.6 package version: v1.1.14

Recently I started getting this error while running my lumen application: The batch of log events in a single PutLogEvents request cannot span more than 24 hours.

Eexception 'Aws\CloudWatchLogs\Exception\CloudWatchLogsException' with message 'Error executing "PutLogEvents" on "https://logs.us-east-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://logs.us-east-1.amazonaws.com` resulted in a `400 Bad Request` response:
{"__type":"InvalidParameterException","message":"The batch of log events in a single PutLogEvents request cannot span mo (truncated...)
 InvalidParameterException (client): The batch of log events in a single PutLogEvents request cannot span more than 24 hours. - {"__type":"InvalidParameterException","message":"The batch of log events in a single PutLogEvents request cannot span more than 24 hours."}'

GuzzleHttp\Exception\ClientException: Client error: `POST https://logs.us-east-1.amazonaws.com` resulted in a `400 Bad Request` response:
{"__type":"InvalidParameterException","message":"The batch of log events in a single PutLogEvents request cannot span mo (truncated...)
 in /application/path/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
...

Is anyone familiar with this type of error? Does this error mean the log stream was pushing logs for more than 24 hours? Can this package handle log streams that old?

Thanks for your help.

webkod3r avatar Jun 29 '21 03:06 webkod3r

Also seeing this though it appears to be incredibly rare. Digging into why this might occur.

roborourke avatar Apr 04 '22 09:04 roborourke

Also getting this, but it's related to when there are few enough requests that it doesn't trigger the batch to be sent until after 24 hours.

I know it is explicitly written in the documentation that this is the case (phpdoc on the method) but maybe we should have some way to flush the batch after a certain period?

lucasantarella avatar Jul 11 '22 23:07 lucasantarella

This is fixed by https://github.com/maxbanton/cwh/pull/107

jackwakefield avatar Nov 01 '22 14:11 jackwakefield

This is fixed by #107

do you know when it will be merged ?

cbulgariu avatar Nov 03 '22 07:11 cbulgariu

Hi guys, it's a little bit hard to maintain war-work-life balance, so sorry for delay. PR is already merged and new version v2.0.3 has been published. Please test it an let me know if everything is ok. Thanks.

maxbanton avatar Nov 07 '22 13:11 maxbanton

Oh man, thanks so much @maxbanton. Will work off a fork rather than put any undue additional pressure on you if there are future issues that need an urgent fix.

roborourke avatar Nov 07 '22 13:11 roborourke

Thanks @maxbanton and sorry to hear that.

webkod3r avatar Nov 08 '22 16:11 webkod3r