Basic
The exporters allow you to export the event audit logs to a different file format.
The following exporters are available:
- CSV Exporter: Exports the event audit logs to a CSV file.
- JSON Exporter: Exports the event audit logs to a JSON file.
- TSV Exporter: Exports the event audit logs to a TSV file.
- XLSX Exporter: Exports the event audit logs to an XLSX file.
Each exporter has its own configuration options. The configuration options are described in the respective exporter's documentation section.
Exporting from code
An exporter can produce a report from a list of events, or straight from filters:
from ckanext.event_audit import types, utils
exporter = utils.get_exporter("csv")()
report = exporter.from_filters(types.Filters(category="api"))
By default the events come from the active repository, pass repo_name to use another one.
The same reports are available on the command line with ckan event-audit export-data, see the CLI reference.
Base exporter class
Base class for all exporters.
Exporters are used to export a list of events to a specific file format.
export(events)
abstractmethod
Export events to a specific format.
We are not providing a specific return type, because it will depend on the specific exporter implementation.
| PARAMETER | DESCRIPTION |
|---|---|
events
|
events to export
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
exported data.
TYPE:
|
from_filters(filters, repo_name=None)
Export events from a repo using the given filters.
If repo_name is not provided, the active repo is used.
| PARAMETER | DESCRIPTION |
|---|---|
filters
|
search filters.
TYPE:
|
repo_name
|
name of the repo to use. Defaults to None.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
exported data.
TYPE:
|