Support reopening audit and debug logs#3521
Support reopening audit and debug logs#3521fremail wants to merge 3 commits intoowasp-modsecurity:v3/masterfrom
Conversation
|
Hi @fremail, thanks for this PR - just for the record, there is (was) a similar PR previously, but for some reason it got stuck, see #2304. But now, could you take a look at the Sonar issues? All of them generated by this PR. If we merge this PR, then - I assume - we should add this new feature to the connector, right? |
|
Hi @airween, Yes, there was a similar PR. I was very disappointed that it stuck for years. I didn't find an option for committing into that PR, so I forked @brandonpayton's work and created this PR. Fixing the Sonar issues.
Right. Let's merge this PR first :) |
|
|
To be honest I don't know the best solution for the Sonar issues. Adding linter exceptions is not a fix actually. Adding platform specific code is also a weird solution. Both options cause extra Sonar issues 🤷♂️ Suggestions are welcome |
|
@airween I've added a PR for the connector as well owasp-modsecurity/ModSecurity-nginx#372 I'm new to this stack and project, so please suggest preferred fixes/ways for the Sonar issues 🙏 |



This PR adds a new C API function
msc_rules_reopen_logs()that allows connectors (Nginx, Apache, etc.) to reopen audit and debug log files without restarting. This is essential for log rotation — after logrotate renames the old file and creates a new one, the connector can call this function (e.g., onSIGUSR1orSIGHUP) to start writing to the new file.Inspired by changes in #2304
Resolves #1968
This change is required for resolving issue 121 in ModSecurity-nginx connector