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
- Create a new folder and copy the script to that folder.
- Logs will be saved in the logs sub-folder with nested year, month, date folders.
- 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).
- 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
- Sign in and start collecting from specified date:
python log_export_example.py -a start -d 2015-01-01 -s
- Stop collection:
python log_export_example.py -a stop
- Restart with previous credentials and state:
python log_export_example.py -a restart