i am a bit stuck and dont know whats the quickest and easiest solution.

We have one domain name lets say www.example.com , however we have many 3rd part sites that are in the directory /export/sites/htdocs/example/

at the moment all access logs and error logs for the 20+ sites we have are stored in one of these files.

I want to split the logging so for example we have www.example.com/test1 to have its seperate access log and error log in its directory:


Whats the best way to achieve this

3 Years
Discussion Span
Last Post by FakeTales

I have looked at setting up virtual hosts however i am a bit lost on doing so.

In the examples they reference separate servernames however we have one server with sites being served from sub directories.


maybe i could do this with aliases?

Edited by FakeTales: added more


maybe i could do this with aliases?

Hmm, no, because the ErrorLog directive can be set only once for each domain. The easiest solution is to create subdomains for each website and configure indipendent directives.

The CustomLog is used to trace the requests to the server, so it's the access log, you could use an environment variable to trace each website and assign indipendent custom logs, check:

Not tested, but something like this in server or virtual context, should work:

<Directory site1>
    SetEnv subwebsite1

<Directory site2>
    SetEnv subwebsite2

CustomLog ${APACHE_LOG_DIR}/site1.log combined env=subwebsite1
CustomLog ${APACHE_LOG_DIR}/site2.log combined env=subwebsite2

So if i go down the root of setting up Directories for these websites am i able to set ErrorLog for these?

Or is the outcome i can only have CustomLog


Ignore what i said above there, i get it now.

Thank you

Edited by FakeTales: Added

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.