简体   繁体   中英

writing logs to cloudwatch from the aws-cli

i'm trying to write a log to cloudwatch (just to understand how it works)

so from the aws-cli (already configured) i'm issuing this command

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

on cloudwatch the group-name and the stream-log already exist anthe the names are correct

the output of the command is the following

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

the user i'm using has the "AdministratorAccess" policy attached (and to be sure i've added "CloudWatchFullAccess" policy as well)

You need to convert your timestamp to milliseconds version (multiply with 1000 in your case)

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

please check examples

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM