Skip to main content
You are viewing the documentation of release 26.1, which is no longer the current one. Go to the documentation of the current release 26.2.

Scrolling Audit Logs

This scenario demonstrates how to efficiently retrieve and process large volumes of audit logs using the scrolling mechanism. While standard pagination is suitable for displaying logs in user interfaces, scrolling provides a more efficient approach for processing complete log sets for analysis, reporting, or archiving. Key features:
  • Efficiently retrieve large volumes of audit logs without pagination limitations
  • Maintain a consistent view of logs during the retrieval process
  • Process complete audit trails for compliance reporting and security analysis
  • Handle millions of log entries with optimal performance

Prerequisites

Before scrolling audit logs, you need:
  • A valid authentication token
  • The “view_logs” permission assigned to your user account
  • Understanding of the scroll mechanism and its lifecycle
  • Sufficient system resources to process the retrieved logs
Scrolling creates server-side resources that must be properly released when finished. Always close scroll contexts when done.

Understanding the Scroll Mechanism

The scroll API is designed for efficiently retrieving large datasets:
  • Scroll Context: A server-side cursor that maintains position in the result set
  • Scroll ID: A unique identifier for the scroll context that must be used in subsequent requests
  • Scroll Timeout: The duration the server keeps the scroll context alive between requests
  • Batch Size: The number of logs retrieved in each scroll request
Unlike pagination, scrolling provides a consistent view of the data even if logs are being added during the scrolling process.

Step 1 - Initialize Scroll Context

This endpoint demonstrates how to initialize a scroll context for retrieving large volumes of audit logs. The scroll context acts as a cursor that maintains your position in the result set, allowing you to efficiently process all matching logs.
  • Creates a server-side scroll context that preserves your position in the result set
  • Returns the first batch of audit logs based on your search criteria
  • Provides a scroll ID that must be used in subsequent scroll requests
  • Maintains a consistent view of the data even if new logs are being added
The scroll timeout specifies in seconds how long the server should keep the scroll context alive between requests. This value refreshes with each request, so you typically only need a few seconds unless processing is very slow.
Endpoint
Request
Response
The response contains the following important properties:
  • scrollId - Located at scrollId in the response.
    • Example value: 5VL5EQHstvo0UKzX67boSqbdDWH4rKgzU0yfDxYvyWY5HLmMmY90oO2YMQTru94f
The response contains the first batch of audit logs matching your criteria and a scroll ID for retrieving subsequent batches.
  • The results array contains the first batch of matching log entries
  • The total field indicates the total number of logs matching your criteria
  • The scrollId is a unique identifier for your scroll context that must be used in subsequent requests
  • Process these logs and then use the scroll ID to retrieve the next batch
The scroll ID may be a long, complex string. Always use it exactly as returned without modification.

Step 2 - Retrieve Next Batch of Logs

This endpoint demonstrates how to retrieve subsequent batches of audit logs using the scroll ID from previous requests. This process continues until all matching logs have been retrieved.
  • Uses the scroll ID from the previous response to maintain position in the result set
  • Returns the next batch of audit logs based on your search criteria
  • Refreshes the scroll timeout to keep the context alive
  • Must be called repeatedly until all logs have been retrieved
Do not specify the ‘from’ parameter in scroll requests as it’s incompatible with scrolling. The scroll context already maintains your position in the result set.
Endpoint
Request
Response
The response contains the following important properties:
  • scrollId - Located at scrollId in the response.
    • Example value: 5VL5EQHstvo0UKzX67boSqbdDWH4rKgzU0yfDxYvyWY5HLmMmY90oO2YMQTru94f
The response contains the next batch of audit logs and a scroll ID for retrieving subsequent batches.
  • The results array contains the next batch of matching log entries
  • The total field remains the same as in the initial request
  • The scrollId may be the same or different from the previous request
  • Continue this process until the results array is empty or smaller than the requested size
Always use the scrollId from the most recent response, as it may change between requests.

Step 3 - Close Scroll Context

This endpoint demonstrates how to properly close a scroll context when you’ve finished retrieving all needed logs. Closing the context releases server resources and is an important best practice.
  • Explicitly releases server resources associated with the scroll context
  • Should be called when you’ve retrieved all needed logs or no longer need the context
  • Requires the scroll ID from your most recent scroll request
Endpoint
Request
Response
The scroll context has been successfully closed and all associated server resources have been released.
After closing a scroll context, its scroll ID becomes invalid. If you need to retrieve more logs, you’ll need to initialize a new scroll context.

Audit Log Scrolling Summary

You have successfully learned how to efficiently retrieve and process large volumes of audit logs using the scrolling mechanism.

Key Concepts

  • Scroll Context: A server-side cursor that maintains position in the result set
  • Scroll ID: A unique identifier for the scroll context used in subsequent requests
  • Scroll Lifecycle: Initialize, retrieve batches, close when finished
  • Batch Processing: Retrieve and process logs in manageable chunks
  • Resource Management: Properly close contexts to prevent server resource leaks

When to Use Scrolling vs. Pagination

  • Use Scrolling: For processing complete log sets, data exports, or deep analysis
  • Use Pagination: For displaying logs in user interfaces or when only a subset of logs is needed

Example Implementation

See our OpenAPI documentation to learn about the full set of API endpoints and parameters.
Please use proper exception handling and function decomposition in your own code. The code is provided for illustrative purposes only and is not intended for production use.