Automatic CloudWatch Intergration
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
### Describe the feature
It would be really handy if there was some global way to configure the CLI to append to cloudwatch log groups by configuration so that every command would attempt to write to a cloudwatch log group based on the profile used to run the command.
Adding a log option to the CLI conf file gives a seed as to where to send any logs, perhaps a log level to control the level of logs sent to the log group (info, warn, error, debug).
Perhaps this could work with other services (SNS, SQS, SES ?) but Cloudwatch seems like a sensible place to start.
### Use Case
I start a S3 recursive cp ec2 instance to upload 1TB of data in a dethatched or screened terminal. the transfer partially fails:
```
2022-05-04T00:00:00-00:00 info - cp s3:/// . --recursive
2022-05-04T00:00:00-00:00 info - s3:/// Started
2022-05-04T00:00:00-00:00 info - s3:/// Started
2022-05-04T00:00:00-00:00 info - s3:/// Started
2022-05-04T00:00:00-00:00 info - s3:/// Started
2022-05-04T01:51:00-00:00 info - s3:/// Copied 250GB @ 150MB/S
2022-05-04T00:30:00-00:00 error - s3:/// Failed [Error 5]
2022-05-04T01:51:00-00:00 info - s3:/// Copied 250GB @ 150MB/S
2022-05-04T01:55:00-00:00 error - s3:/// Failed, Ran out of disk space
2022-05-04T01:55:01-00:00 info - Job Completed, success: 2, failed: 2 Transfered 725GB
```
### Proposed Solution
For example for a .aws/config
```
[default]
region = ca-central-1
output = json
log = arn:aws:logs:ca-central-1::log-group:my-cli-logs:*
log-level = info
```
### Other Information
Obviously the logging would need to fail (gracefully/silently) so that failure to log does not fail the task by default, but maybe others will require that all CLI entries be logged.
There would also need to be some way to confirm that the CLI has permission is able to send logs to cloudwatch or other services.
All of this seems complicated to get right, but would greatly increase the utility of the CLI without having to require the user to make a shim just to implement logging.
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CLI version used
1.18.147
### Environment details (OS name and version, etc.)
All
Contributor guide
Assessment
This issue has not been assessed yet.