audit_logs¶
The following methods allow for interaction with the ZWA Audit Logs API endpoints.
Methods are accessible via zwa.audit_logs
Copyright (c) 2023, Zscaler Inc.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- class AuditLogsAPI¶
Bases:
APIClient- audit_logs(query_params=None, fields=None, time_range=None, **kwargs)¶
Filters audit logs based on the specified time period and field values.
The result includes audit information for every action made by the admins in the Workflow Automation Admin Portal and the actions made through APIs.
Supported field values:
ActionResourceAdminModule
Supported time range values:
Start date and timeEnd date and time
- Parameters:
query_params (dict, optional) –
Map of query parameters for the request.
page(int, optional): Specifies the page number of the incident in a multi-paginated response.This field is not required if
page_idis used.
page_size(int, optional): Specifies the page size (i.e., number of incidents per page). Max: 100.page_id(str, optional): Specifies the page ID of the incident in a multi-paginated response.The page ID can be used instead of the page number.
fields (list, optional) –
A list of field filters.
Example:
[ {"name": "severity", "value": ["high"]}, {"name": "status", "value": ["open", "resolved"]} ]
time_range (dict, optional) –
Time range for filtering incidents.
Example:
{ "startTime": "2025-03-03T18:04:52.074Z", "endTime": "2025-03-03T18:04:52.074Z" }
- Returns:
The audit log search results.
- Return type:
Examples
Perform an audit log search with a severity filter:
search, _, error = client.zwa.incident_search.audit_logs( fields=[{"name": "severity", "value": ["high"]}], time_range={"startTime": "2025-03-03T18:04:52.074Z", "endTime": "2025-03-03T18:04:52.074Z"} )
If an error occurs:
if error: print(f"Error fetching audit logs: {error}") else: for log in search: print(log.as_dict())