Skip to content

Conversation

hilmarf
Copy link
Member

@hilmarf hilmarf commented Sep 3, 2025

This pull request introduces a comprehensive audit logging capability to the OpenTelemetry Java SDK, focusing on file-based storage and processing of log records. The main changes are:

  1. New Audit Log Components
  • AuditLogRecordProcessor.java & AuditLogRecordProcessorBuilder.java
    Introduces a processor for audit log records, enabling custom handling and export logic. Builder pattern allows flexible configuration of the processor.

  • AuditLogStore.java
    Defines the interface for audit log storage, enabling extensibility for different storage backends.

  • AuditException.java & AuditExceptionHandler.java
    Adds custom exception and handler classes for robust error management in audit logging operations.

  • AuditLogFileStore.java
    Implements a thread-safe, file-based store for audit logs. Supports concurrent read/write operations using a ReadWriteLock. Prevents duplicate log entries by maintaining a set of record IDs. Uses Jackson for JSON serialization/deserialization of log records. Provides methods to save, retrieve, and remove log records. Handles file creation, directory management, and ensures file accessibility.

  • JsonLogRecordData.java
    Provides a JSON-serializable representation of log records for storage and retrieval.

  1. Exporter Improvements
  • MultiLogRecordExporter.java
    Refactored to simplify handling of multiple exporters. Improved retry logic and error handling for log export operations.
  1. Build & Dependency Updates
  • build.gradle.kts
    Adds com.fasterxml.jackson.core:jackson-databind as a compile-only dependency for JSON processing.
  1. Testing
  • AuditLogFileStoreTest.java
    Unit tests for the file-based audit log store, covering save, retrieve, and remove operations.

  • AuditLogRecordProcessorTest.java
    Tests for the new processor, ensuring correct processing and export of audit log records.

  • BatchLogRecordProcessorTest.java
    Additional tests to verify batch processing logic in the context of audit logs.

Summary

This PR significantly enhances the OpenTelemetry Java SDK with robust, extensible audit logging capabilities, including file-based storage, custom processing, and improved exporter logic. The changes are well-tested and modular, laying the groundwork for future audit log features and integrations.

hilmarf added 19 commits August 20, 2025 15:25
Signed-off-by: Hilmar Falkenberg <[email protected]>
Signed-off-by: Hilmar Falkenberg <[email protected]>
Signed-off-by: Hilmar Falkenberg <[email protected]>
Signed-off-by: Hilmar Falkenberg <[email protected]>
Signed-off-by: Hilmar Falkenberg <[email protected]>
Signed-off-by: Hilmar Falkenberg <[email protected]>
Signed-off-by: Hilmar Falkenberg <[email protected]>
@hilmarf hilmarf moved this to In review in OTel-Audit-Logging Sep 3, 2025
@hilmarf hilmarf requested a review from a team September 3, 2025 15:25
@hilmarf hilmarf changed the title Audit log feat: add new AuditLogRecordProcessor + AuditLog[File]Store Sep 3, 2025
Signed-off-by: Hilmar Falkenberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant