我正在尝试像这样将 Log 放在 amazon CloudWatchLogs 上:
$response2 = $amzonLoger->putLogEvents([
'logGroupName' => 'myGroup',
'logStreamName' => 'myStream',
'logEvents' => [
[
'timestamp' => time(),
'message' => 'message'
],
],
'sequenceToken' => lastToken,
]);
var_dump($response2);
但我总是有这样的回应:
bject(Guzzle\Service\Resource\Model)#289 (2) { ["structure":protected]=> NULL ["data":protected]=> array(2) { ["nextSequenceToken"]=> string(56) "495401145812734324234234236420825819917076850" ["rejectedLogEventsInfo"]=> array(1) { ["tooOldLogEventEndIndex"]=> int(1) } } }
你能帮我理解 ["rejectedLogEventsInfo"]=> array(1) { ["tooOldLogEventEndIndex"]=> int(1)
是什么意思吗?
最佳答案
我找到了添加这一行而不是 php 的 time()
函数的解决方案。按照这个example cloudWatchLogs .
'timestamp' => round(microtime(true) * 1000),
我希望这能对 future 的人有所帮助。
关于php - PHP 中的 Amazon CloudWatchLogs putLogEvents 给出了错误 tooOldLogEventEndIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32875451/