Giter VIP home page Giter VIP logo

aws_cloudtrail_extract_logs's Introduction

AWS Extract CloudTrail Logs from S3

This Python solution extracts CloudTrail logs from S3 for a user specified date range

What problem does this solve?

CloudTrail log data is often delivered to S3 for long term retention and safe keeping. When a CloudTrail trail is configured to deliver log data to S3, the log data is sent to S3 approximately every 5 minutes and is compressed into a GZ file. Prefixes are added to the S3 objects to arrange them by date and account number. Specific date ranges of this data may be needed from time to time for incident response or forensics but extracing a specific date range of data can e challenging.

This Python solution extracts the log entries from S3 and writes them to a flat text file in JSON format for further analysis. A maximum size can be configured for the output file and the solution will create multiple files as needed.

Requirements

Python Runtime and Modules

Setup

This solution is designed to be run by using an AWS IAM Role. The role must have list s3:ListBucket and s3:GetObject permissions on the S3 bucket where the CloudTrail logs are stored. The solution assumes that the bucket is dedicated to CloudTrail and there are no other objects in the bucket using the CloudTrail prefix.

The user specified date and time must be in the format of MM/DD/YYYY

A sample parameters file is included.

Running

python aws_extract_cloudtrail_logs.py --parameterfile parameters.json [--logfile cloudtrail-extract.log]

aws_cloudtrail_extract_logs's People

Contributors

mattfeltonma avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

bhanu-prakashl

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.