本文介绍了PHP中的Amazon CloudWatchLogs putLogEvents也给出错误OldLogEventEndIndex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Amazon CloudWatchLogs像这样登录:

hi guys i'm trying to put Log on amazon CloudWatchLogs like this:

$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),我将非常感谢您的帮助。

can u help me understanding what does mean ["rejectedLogEventsInfo"]=> array(1) { ["tooOldLogEventEndIndex"]=> int(1), I will be very grateful for the help.

推荐答案

好,我发现解决方案添加了这一行,而不是php的 time()函数。遵循此。

ok guys i found the solution adding this line instead of time() function of php . following this example cloudWatchLogs.

'timestamp' =>  round(microtime(true) * 1000),

我希望这对以后的工作有所帮助

i hope that this can help someone on the future thanks.

这篇关于PHP中的Amazon CloudWatchLogs putLogEvents也给出错误OldLogEventEndIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 06:52