php - PHP 中的 Amazon CloudWatchLogs putLogEvents 给出了错误 tooOldLogEventEndIndex

标签 php amazon-web-services zend-framework2 amazon-cloudwatch

我正在尝试像这样将 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/

相关文章:

javascript - ajax 调用和 Controller 函数中的多个循环值

php - 即使已在 AWS SQS PHP SDK 中提供,也会出现缺少参数错误

amazon-web-services - 在 EKS 上的 Kubernetes 1.14 上启动 Helm Chart stable/minecraft 失败 Liveness Probe

amazon-web-services - 带有 SQS 触发器的 AWS lambda 不断重试并将作业放回队列中

url - 在 url 中路由 Zend Framework 2 语言

php - 使用 liipImagineBundle 更新/删除记录时删除/更新缓存图像

用于获取日期范围内所有星期一的php函数

java - 有没有办法在 S3 中连续写入流(逐行)

php - 如何访问 ZF2 Field Set 中的数据库适配器?

pagination - 如何在 Zend Framework 2 中实现搜索模块的分页?