Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow logging host name in the access log when using multiple virtual domains #1019
Originally reported by: Anonymous
If you have a webapp that serves multiple virtual hosts, the distinction which page was served for which host can't be recorded in the logfile, since there is currently no way to have the request.headers['host'] logged in access.log. For that, I made a one line addition to _cplogging.py/access(), in the atoms dict, I added an entry 'o' which allows one to log the Host the request came from.
With the patch, it becomes possible to do this:
The patch, against trunk #2689:
Reported by email@example.com
Original comment by Anonymous:
Ah, to clarify:
In my application, which serves hundreds to thousands of virtual domains, it will be undesirable to have so much logfiles lying around (and being open and written to simultaneously). I plan to do the log analysis later, based on selective extraction of log lines using the virtualhostname.
Furthermore, I do not propose a change to the logging format, only the ''possibility'' of using the virtual hostname in the log, if someone desires so (this requires explicit redefinition of app.log.access_log_format, if you leave that at the default you'll get a perfectly conforming CLF, even with my patch in place).
Thinking of it, it would be nice if access() could log any field from inheaders or outheaders, not just the pre-canned ones. But that's an exercise for later ;-)