Repo includes a simple Python 2.7.9 script for downloading EventLogFiles.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

A Simple Python Script for Downloading EventLogFiles

Pre-requisites is built on the Python Standard Library. Your script will automatically import the following modules:

  • import urllib2
  • import json
  • from StringIO import StringIO
  • import ssl
  • import getpass
  • import os
  • import sys

As a result, there shouldn't be a need to install any other modules. However, you should verify that you have version 2.7.9 of python. Open a terminal (or cmd in Windows) and type:

  $ python --version

You should see

  Python 2.7.9

If you do not, you may need to install it:

If you have multiple versions of python installed, you can declare which version you want on the command line:

  $ python2.7 --version

For more information, read the help topic (


To use this script, just click the Download ZIP button in GitHub and store locally on your laptop or desktop.

Run Script

From the terminal, navigate to the directory where you downloaded For instance

  $ cd ~/Users/atorman/Desktop

To run the script, type:

  $ python

You will be prompted for several inputs:

  1. Username
  2. Password (hidden)
  3. Date range (recommend: Last_n_Days:2 instead of Yesterday)
  4. Output directory

It's possible to change the defaults for these four prompts within the code. I recommend this if you want to test or automate the script.

The output will be an Event Log File CSV (Comma Separated Values) file for each day in the date range with the following file name convention: yyyy-mm-dd-eventtype.csv. For instance:



I tested this script on Ubuntu Linux, Mac OSX, and Microsoft Windows platform. However, that doesn't mean you won't run into problems.

One issue I did encounter was the use of a security token with your password if you are in a non-whitelisted organization or profile. Many administrators won't encounter this but if you try to log into the API without the token, you'll be blocked.

To reset your token, go to My Settings | Personal | Reset My Security Token.

If you don't see this menu item, then a security token is not required.

When entering your password with a security token, the token follows your password:

If your password = "mypassword" And your security token = "XXXXXXXXXX" You must enter "mypasswordXXXXXXXXXX" in place of your password

You can also read more about this in the help topic (

You may also encounter a login error due to the ClientId and ClientSecret. If you do, make sure to change the constants in to reflect your own ClientId and ClientSecret. You can read more about how to create your own ClientId and ClientSecret in the help topic (

Supported platforms

Supported platforms: MacOS, Linux, and Windows.

Getting help

tweet to @atorman:

or post a comment to