簡體   English   中英

從 aws-cli 將日志寫入 cloudwatch

[英]writing logs to cloudwatch from the aws-cli

我正在嘗試將日志寫入 cloudwatch(只是為了了解它是如何工作的)

所以從 aws-cli (已經配置)我發出這個命令

aws logs put-log-events --log-group-name testgroup --log-stream-name teststream1 --log-events timestamp=1587488538,message=hello

在 cloudwatch 上,組名和流日志已經存在,並且名稱是正確的

命令的output如下

{ "rejectedLogEventsInfo": { "tooOldLogEventEndIndex": 1 } }

我正在使用的用戶附加了“AdministratorAccess”策略(並確保我也添加了“CloudWatchFullAccess”策略)

您需要將時間戳轉換為毫秒版本(在您的情況下乘以 1000)

aws logs put-log-events --log-group-name testgroup --log-stream-name teststream1 --log-events timestamp=1587488538000,message=hello

請檢查示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM