audit_logs#

The following methods allow for interaction with the ZIA Audit Logs API endpoints.

Methods are accessible via zia.audit_logs

class AuditLogsAPI#
cancel()#

Cancels the request to create an audit log report.

Returns:

The operation response code.

Return type:

int

Examples

>>> zia.audit_logs.cancel()
create(start_time, end_time)#

Creates an audit log report for the specified time period and saves it as a CSV file. The report includes audit information for every call made to the cloud service API during the specified time period. Creating a new audit log report will overwrite a previously-generated report.

Parameters:
  • start_time (str) – The timestamp, in epoch, of the admin’s last login.

  • end_time (str) – The timestamp, in epoch, of the admin’s last logout.

Returns:

The status code for the operation.

Return type:

int

Examples

>>> zia.audit_logs.create(start_time='1627221600000',
...    end_time='1627271676622')
get_report()#

Returns the most recently created audit log report.

Returns:

String representation of CSV file.

Return type:

str

Examples

Write report to CSV file:

>>> with open("audit_log.csv", "w+") as fh:
...    fh.write(zia.audit_logs.get_report())
status()#

Get the status of a request for an audit log report.

Returns:

Audit log report request status.

Return type:

Box

Examples

>>> print(zia.audit_logs.status())