Export logs to preserve entries before cleanup

Created on 21 April 2025, 2 months ago

Problem/Motivation

The log_entity_operations module stores actions performed on entities such as nodes and files. On large-scale websites, the number of entity operations can be very high, causing the log table to grow quickly and reach its configured storage limit.

Currently, old log entries are deleted to enforce the limit, which can lead to the loss of valuable information. There is no built-in mechanism to persist or archive this data before it is deleted.

To preserve the log data beyond the database limit, we need a way to:

  • Export log entries to a CSV file before deletion
  • Import the CSV files later for further analysis or debugging purposes

Steps to reproduce

  1. Enable the log_entity_operations module on a large Drupal 10 site
  2. Perform multiple content operations (e.g., create/edit/delete nodes or files)
  3. Wait until the log table reaches the configured maximum size
  4. Observe that older logs are deleted automatically without the ability to export or recover them

Proposed resolution

Implement functionality to:

  • Automatically export log entries to a CSV file before they are deleted due to table size constraints
  • Enable importing previously exported CSV files to allow review or re-analysis of historical logs

Remaining tasks

  • Design the export format (fields, structure)
  • Implement CSV export logic
  • Determine trigger points (e.g., before cleanup)
  • Provide import logic with validation
  • Update README and configuration options

User interface changes

  • Optional: CSV import form for uploading logs

API changes

None currently anticipated, unless a public export/import service is added for reuse.

Data model changes

None expected. Export will be to external files and import will read from them, using the existing schema.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024