I'd like to prepend the vhost name in my ErrorLog and then pipe it into a program I wrote.
Is it possible to write Custom Error log format as it is with Access log?
I'd like to prepend the vhost name in my ErrorLog and then pipe it into a program I wrote.
Is it possible to write Custom Error log format as it is with Access log?
For piping see the ErrorLog directive and Piped Logs official manual entries which explain it pretty well.
Getting a custom error log format is more difficult. You can customize the access log easily with
LogFormat
but there is nothing built in for modifying the error log format. I did come across CGI::Carp which is a Perl module for outputting to the error log. Finally, there is always modifying the Apache source code directly depending on how badly you want this feature.In Apache 2.2 you cannot change the format of error_log easily - see http://httpd.apache.org/docs/2.2/logs.html#errorlog.
Apache 2.4 adds this support. See http://httpd.apache.org/docs/2.4/logs.html#errorlog.
With Apache 2.4 you can use the
ErrorLogFormat
directive.Syntax:
ErrorLogFormat [connection|request] format
Simple example
Example (default format for threaded MPMs)
Example (similar to the 2.2.x format)
Advanced example with request/connection log IDs
Source: ErrorLogFormat Directive
You are probably looking for mod_log_debug.