Cloud watch log service is a service help us collect logs from client. Shipping build won't generate log files. So, using cloud watch to collect some important log will be an alternative way to get log from shipping build.
create cloud watch logs object
To access cloud logs service, we need to create a cloud watch logs object on client side.
We can use development build for the server side and download the log file from gamelift console for the server side or enable server mode and use it with imds.
Access key id and secret key credentials is required by all cloud watch logs object nodes. We can get access key id and secret key from pre-created IAM user or get allocated from cognito identity pool.
collect logs
Cloud watch logs service organize logs in log stream. A group of stream is called log group.
Most of aws report their logs in cloud watch logs service as well. Each resource in aws will use a log group. We need to create a log group for our client to use cloud watch logs service.
We can set logs' retention time when we create log group and after we create log group.
With log group, we can create log stream in our game by calling create log stream with log group name, log stream name.
We can call describe log streams with log group name to list all log streams in a log group. Or we can call it with log stream name prefix(log stream name) as well to get details of a log stream.
Describe log streams will return upload sequence token in each log stream in describe log streams result. We need to use the upload sequence token to upload log events to the log stream.
We can call put log events with log group name, log stream name, log events, sequence token.
Put log events will return next sequence token for the next put log events call as well.
If we want to delete a log stream, we can call delete log stream with log group name, log stream name.