Giter Club home page Giter Club logo

amazon-ecs-logs-collector's Introduction

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:

  • 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 Systemd init systems and Amazon Linux)
  • 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/aws/amazon-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-YYYYMMDDHHmm.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 or enable-debug mode. Enable debug is only available for Systemd init systems and Amazon Linux.

# bash ecs-logs-collector.sh --help
USAGE: ./ecs-logs-collector.sh [--mode=[brief|enable-debug]]
       ./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.
     enable-debug  Enables debug mode for the Docker daemon and the Amazon
                   ECS Container Agent. Only supported on Systemd init systems
                   and Amazon Linux.

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 and containerd daemon logs ... ok
Trying to collect Docker systemd unit file ... ok
Trying to collect containerd systemd unit file ... ok
Trying to collect Docker sysconfig ... ok
Trying to collect Docker storage sysconfig ... ok
Trying to collect Docker daemon.json ... 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 get open files list ... ok
Trying to collect /etc/os-release ... ok
Trying to get uname kernel info ... ok
Trying to get dmidecode info ... ok
Trying to get lsmod info ... ok
Trying to collect systemd slice info ... ok
Trying to get veth info ... ok
Trying to get gpu info ... ok
Trying to archive gathered log information ... ok

Example output in enable-debug mode

The following output shows this project enabling debug mode for the Docker daemon and the Amazon ECS Container Agent. This mode only works on Amazon Linux OS and Systemd init systems such as RHEL 7 and Ubuntu 16.04. Note that enable-debug mode restarts Docker and the Amazon ECS agent.

# bash ecs-logs-collector.sh --mode=enable-debug
Trying to check if the script is running as root ... ok
Trying to collect system information ... ok
Trying to enable debug mode for the Docker daemon ... ok
Trying to restart Docker daemon to enable debug mode ... ok
Trying to enable debug mode for the Amazon ECS Container Agent ... ok
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.

amazon-ecs-logs-collector's People

Contributors

jahkeup avatar fjromerom avatar slacksec avatar sparrc avatar unakarlsen avatar singholt avatar jhaynes avatar willhoule avatar fenxiong avatar rohanmangal avatar dsalamancams avatar mmssantos avatar aaithal avatar chienhanlin avatar hprudent avatar hugoprudente avatar witsoej avatar mfortin avatar nitishtw avatar ovalba avatar sharuzzaman avatar nithu0115 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.