Skip to content

The script will be used to collect general os logs as well as Docker and ecs-agent logs, it also support to enable debug mode for docker and ecs-agent in Amazon Linux.

License

arun-amzn/ecs-logs-collector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECS Logs Collector

This project was created to collect Amazon ECS log files and Operating System log files for troubleshooting Amazon ECS customer support cases.

The following functions are supported:

  • Supported OS: Amazon Linux, Amazon Linux 2, Red Hat Enterprise Linux 7, CentOS, Debian 8, Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04
  • Collect Operating System logs
  • Collect Operating System settings
  • Collect Docker logs
  • Collect Amazon ECS agent Logs
  • Enable debug mode for Docker and the Amazon ECS agent (only available for Amazon Linux and Amazon Linux 2)
  • Create a tar zip file in the same folder as the script

Usage

Run this project as the root user:

# curl -O https://raw.githubusercontent.com/awslabs/ecs-logs-collector/master/ecs-logs-collector.sh
# bash ecs-logs-collector.sh

Confirm if the tarball file was successfully created (it can be .tgz or .tar.gz)

#ls collect*
collect-i-ffffffffffffffffff.tgz

collect:
i-ffffffffffffffffff

Retrieving the logs

Download the tarball using your favourite Secure Copy tool.

Example output

The project can be used in normal, debug or debug-only (enable debug is only available for Amazon Linux and Amazon Linux 2).

# bash ecs-logs-collector.sh --help
USAGE: ecs-logs-collector.sh [--mode=[brief|debug|debug-only]]
       ecs-logs-collector.sh --help

OPTIONS:
     --mode  Sets the desired mode of the script. For more information,
             see the MODES section.
     --help  Show this help message.

MODES:
     brief       Gathers basic operating system, Docker daemon, and Amazon
                 ECS Container Agent logs. This is the default mode.
     debug       Collects 'brief' logs and also enables debug mode for the
                 Docker daemon and the Amazon ECS Container Agent.
     debug-only  Enables debug mode for the Docker daemon and the Amazon
                 ECS Container Agent without collecting logs.

Example output in normal mode

The following output shows this project running in normal mode.

# bash ecs-logs-collector.sh
Trying to check if the script is running as root ... ok
Trying to resolve instance-id ... ok
Trying to collect system information ... ok
Trying to check disk space usage ... ok
Trying to collect common operating system logs ... ok
Trying to collect kernel logs ... ok
Trying to get mount points and volume information ... ok
Trying to check SELinux status ... ok
Trying to get iptables list ... ok
Trying to detect installed packages ... ok
Trying to detect active system services list ... ok
Trying to gather Docker daemon information ... ok
Trying to inspect all Docker containers ... ok
Trying to collect Docker daemon logs ... ok
Trying to collect Amazon ECS Container Agent logs ... ok
Trying to collect Amazon ECS Container Agent state and config ... ok
Trying to collect Amazon ECS Container Agent engine data ... ok
Trying to collect Amazon ECS init logs ... ok
Trying to archive gathered log information ... ok

Example output in debug-only mode

The following output shows this project running in debug-only mode. Note that running in debug mode restarts Docker and the Amazon ECS agent.

# bash ecs-logs-collector.sh --mode=debug-only
Trying to check if the script is running as root ... ok
Trying to resolve instance-id ... ok
Trying to collect system information ... ok
Trying to enable debug mode for the Docker daemon ... Trying to restart Docker daemon to enable debug mode ... ok
Trying to enable debug mode for the Amazon ECS Container Agent ... Trying to restart the Amazon ECS Container Agent to enable debug mode ... ok

Contributing

Please create a new GitHub issue for any feature requests, bugs, or documentation improvements.

Where possible, submit a pull request for the change.

License

Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

http://aws.amazon.com/apache2.0/

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

The script will be used to collect general os logs as well as Docker and ecs-agent logs, it also support to enable debug mode for docker and ecs-agent in Amazon Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%