Send files to CloudWatch logs.
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.
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
This software is licensed under the MIT license (see LICENSE.txt).
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/.
Content type
Image
Digest
Size
32.6 MB
Last updated
over 5 years ago
docker pull adarnimrod/cw-logs