You want to have separate activity logs for each of your virtual hosts, but you don't want to have all the open files that multiple CustomLog directives would use.
Use the split-logfile program that comes with Apache. To split logfiles after they've been rolled over (replace /path/to/ServerRoot with the correct path):
# cd /path/to /ServerRoot # mv logs/access_log logs/access_log.old # bin/apachectl graceful [wait for old logfile to be completely closed] # cd logs # ../bin/split-logfile < access_log.old
To split records to the appropriate files as they're written, add this line to your httpd.conf file:
CustomLog "| /path/to/split-logfile /usr/local/Apache/logs" combined
In order for split-logfile to work, the logging format you're using must begin with "%v " (note the blank after the v). This inserts the name of the virtual host at the beginning of each log entry; split-logfile will use this to figure out to which file the entry should be written. The hostname will be removed from the record before it gets written.
There are two ways to split your access logfile: after it's been written, closed, and rolled over, or as the entries are actually being recorded. To split a closed logfile, just feed it into the split-logfile script. To split the entries into separate files as they're actually being written, modify your configuration to pipe the log messages directly to the script.
Each method has advantages and disadvantages. The rollover method requires twice as much disk space (for the unsplit log plus the split ones) and that you verify that the logfile is completely closed. (Unfortunately there is no guaranteed, simple way of doing this without actually shutting down the server or doing a graceless restart; it's entirely possible that a slow connection may keep the old logfile open for a considerable amount of time after a graceful restart.) Splitting as the entries are recorded is sensitive to the logging process dying although Apache will automatically restart it, log messages waiting for it can pile up and constipate the server.