Knowing about log export script

Describes about log export example script.

The log export script below will run on the Python 3 framework. Admins must install/use Python 3 for the script to work.

Note:

When running the script, you must run the command individually for each log page you are trying to export. The script will error out if you try to export 2 or more of the logs at the same time with a single command entry. This means you must run the command separately for each of the logs you can access:

  • access
  • cloudsummary
  • cloudaudit
  • admin
  • swgweb
  • swgwebdlp

You can download sample log script from Download link.

Setup

  1. Create a new folder and copy the script to that folder.
  2. Logs will be saved in the logs sub-folder with nested year, month, date folders.
  3. Script can be started and stopped any time and will resume from the last saved state (-d starts a new collection from the specified date).
  4. Script execution logs are saved in log_cloudapilogs.log. Check the log to ensure logs are being collected.

Usage

python log_export_example.py [-h] -a {start,stop,restart} [-d DATE] [-s]
Options Description
-h Show help message and exit
-a {start,stop,restart} Start, Stop or Restart the service
-d date ISO-formatted start date (UTC), for example, "2015-01-01" or "2015-01-01T00:00:00Z"
-s Prompt for admin username and password

Examples

  1. Sign in and start collecting from specified date:

    python log_export_example.py -a start -d 2015-01-01 -s

  2. Stop collection:

    python log_export_example.py -a stop

  3. Restart with previous credentials and state:

    python log_export_example.py -a restart