I would like to set up custom logging for my vhosts in Apache 2.2:
What I'm looking for is a way to define a custom log format (once) that I can then use as the format for all of my vhost's configs custom logs.
Can I define the log format at the top of my vhost.conf file then refer to it within each vhost directive (Or do I define it in the main httpd.conf)? — OR do I have to define it once for each vhost block?
Thanks
Best Answer
Are you asking just for the log format definition in one place?
In your main server config, use the LogFormat directive:
Note the end
vhost_common
is the nickname.Then, you can specify in each vhost block to use that format for the log: