Skip to content

High RAM Usage with Concurrent Logging Mode in ModSecurity #3414

@SonNgo2211

Description

@SonNgo2211

Description

I am experiencing an issue where my application consumes a high amount of RAM when using the Concurrent Logging mode in ModSecurity. The memory usage increases gradually over time and does not decrease, even after periods of low activity, until I cleaned the logs.

Environment

  • ModSecurity Version: 3.0.13
  • Web Server: Nginx 1.27.1
  • Application Details: a PHP-based web app
  • Concurrent Logging Configuration:
    SecAuditLogType Concurrent
    SecAuditLogStorageDir /var/log/modsec/audit

Steps to Reproduce

  1. Enable Concurrent Logging mode in ModSecurity configuration.
  2. Run the application under normal traffic.
  3. Monitor RAM usage over time (e.g., using top or htop or metric Grafana).
  4. Observe that RAM usage increases continuously without dropping.
  5. Clear the log in /var/log/modsec directory and watch the RAM decrease.

Expected Behavior

  • RAM usage should remain stable or decrease during low traffic periods.

Actual Behavior

  • RAM usage increases gradually and does not decrease, leading to potential memory exhaustion.

Additional Information

Ram increased from 300MiB to 4GiB in almost 30 days on nginx:
Image

Ram usage reduced after cleaning up logs:
Image

Request

I would appreciate any insights or solutions to mitigate this memory consumption issue. Is there a recommended configuration for Concurrent Logging to prevent memory leaks, or is this a bug?

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions