We are fetching audit logs on a daily basis using this method.
It works when fetching all the logs but yield inconsistent results when using the cursor to fetch new events:
/fireblocks/ingestion.py(57)get_audits() -> audits = fireblocks.audit_logs.get_audit_logs(cursor=checkpoint).result() (Pdb) print(checkpoint) [1729165219093] (Pdb) n >
/fireblocks/ingestion.py(58)get_audits() -> audits = audits.data.to_dict() (Pdb) print(audits.data.to_dict()) {'data': [], 'total': 473, 'cursor': None}
``
We save the cursor as a "checkpoint", to then collect the logs next time starting from that checkpoint (cursor).
retrieve logs
configuration = ClientConfiguration(api_key=api_key, secret_key=private_key,
base_path=BasePath.US)
with Fireblocks(configuration) as fireblocks:
# the endpoint uses an async function and returns an iterator
audits = fireblocks.audit_logs.get_audit_logs(cursor=checkpoint).result()
audits = audits.data.to_dict()
Is this a misuse of the cursor ? As a comparison if I run the method without the cursor parameter I have consistent results:
(Pdb) print(fireblocks.audit_logs.get_audit_logs().result().data.to_dict()) {‘data’:[…very long list…]', ‘cursor’: ‘[1729530261791]’, ‘total’: 1405}
This is the source code we looked at:
[audit_logs_api.py](https://github.com/fireblocks/py-sdk/blob/master/fireblocks/api/audit_logs_api.py)
def get_audit_logs(
![<https://github.com/fireblocks/py-sdk|fireblocks/py-sdk>|16x16](https://slack-imgs.com/?c=1&o1=wi32.he32.si&url=https%3A%2F%2Fslack.github.com%2Fstatic%2Fimg%2Ffavicon-neutral.png)[fireblocks/py-sdk](https://github.com/fireblocks/py-sdk) | Added by [GitHub](https://krakenx.slack.com/services/B06BDLV9BFV)