Skip to content
Snippets Groups Projects
Adar Nimrod's avatar
nimrod authored
I'll decide on this later.
84b5b997
History

AWS ClougWatch Agent

pipeline status

Send files to CloudWatch logs.

Usage

Run with the directory of the log file mounted inside the container and specifying the LOG_GROUP_NAME, LOG_STREAM_NAME and LOG_FILE environment variables. Also, the usual AWS CLI environment variables can also be specified. Lastly, the AWS region is deduced on startup by accessing the instance metadata, unless the AWS_DEFAULT_REGION enviroment variable is specified. By default the container uses the nobody user, but you may need to specify a different user in case the log file is not readable but that user. For file rotation detection, don't mount just the file but the whole directory inside the container.

Example usage

docker run -d -v '/var/log:/var/log:ro' -e 'LOG_GROUP_NAME=/var/log/' -e 'LOG_STREAM_NAME={instance_id}' -e 'LOG_FILE=/var/log/ecs/ecs-agent.log.*' adarnimrod/cw-logs

License

This software is licensed under the MIT license (see LICENSE.txt).

Author Information

Nimrod Adar, contact me or visit my website. Patches are welcome via git send-email. The repository is located at: https://git.shore.co.il/explore/.