License: MIT

This is a script to export logs from AWS CloudTrail to a local file.

Getting Started


  • python 3
  • boto3
  • pip


First of all you need to clone this repository:

git clone

After clone access the folder:

cd cloudtrail-export-logs

Running the script

To run the script you need to feel some arguments:

  • “-s”, “–startime”: The start time to get the logs, example 2021-12-01
  • “-e”, “–endtime”: The end time to get the logs, example 2021-12-31
  • “-r”, “–region”: The AWS region to get the logs, example us-east-1
  • “-a”, “–accountid”: The Account ID to get the logs: example 012345678901

Example of command:

python3 --startime 2021-12-01 --endtime 2021-12-31 --region us-east-1 --accountid 012345678901

The script will generate a structure like this:

|-- output
|   `-- 012345678901
|       `-- us-east-1
|           `-- cloudtrail-from-2021-12-01-to-2021-12-31-ID-012345678901-region-us-east-1.txt


To delete the script, you can run the following command to delete the folder:

rm -rf cloudtrail-export-logs


Please read for details on our code of conduct, and the process for submitting pull requests to us.


See also the list of contributors who participated in this project.


This project is licensed under the MIT License – see the LICENSE file for details


View Github