-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ErrorLogFormat compatibility #2887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For module's name: it's interesting that you do not have the fulfilled module name, it's already in v2, and it works on my side:
(I do not want to replace my For duplicate client field: I'm not sure what was the original reason for the hardcoded second For formatting: I do not see the issue there, your 3rd line formatted as you described in your |
My fault, I wasn't on the latest branch For duplicate client field, I guess everybody will agree it's a bug (and it's breaking parsers when exporting logs to a SIEM, Elastic, ...)
Obviously, but I wonder why the message runs before the ErrorLogFormat is taken into account. It's the only module with this behaviour. ErrorLogFormat being in core, it should be processed before mod_security2. The custom format was only given as example, but the timestamp format may be important for parsers when exporting logs to a SIEM, Elastic, ... |
Problem is solved with PR #1997 |
ModSecurity v2/master in httpd doesn't use the right log format in error log when using custom error logs.
Example:
ErrorLogFormat "<%{cu}t> <%-m:%l> <pid %P:tid %T> %7F: %E: <client\ %a> %M%
Example of a standard entry:
<2023-04-03 14:57:25.021425> <ssl:trace1> <pid 34660:tid 524> ssl_engine_init.c(931): Configuring client authentication
ModSecurity entries:
Line 1: the module name not fulfilled
Line 2: everything is hard-coded to default values
Line 3: the module name not fulfilled, [client] is duplicated
[client] duplicated: this is easy to fix: in internal_log_ex(), we have
ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, "[client %s] ModSecurity: %s%s [uri \"%s\"]%s", r->useragent_ip ? r->useragent_ip : r->connection->client_ip, str1, hostname, log_escape(msr->mp, r->uri), unique_id);
removing "[client %s] " and "r->useragent_ip ? r->useragent_ip : r->connection->client_ip, " solves the problem
Module name not fulfilled: this looks easy
In mod_security2.c, we have:
module AP_MODULE_DECLARE_DATA security2_module = {...
It should be
This fills the module name on line 2, but not on line 3. Any idea why?
Line 2: Does mod_security2 initiliaze before the directive ErrorLogFormat is parsed?
It's in httpd core, so it's weird.
Any idea how to take ErrorLogFormat into account?
The text was updated successfully, but these errors were encountered: