If I dont set a error log inside a virtual host it will default to the default error/access log. Is there a way to turn this off for one virtual host?
Asked
Active
Viewed 2.4k times
3 Answers
39
Within your <VirtualHost>
block for the vhost in question you can configure the logs to be sent to /dev/null
<VirtualHost *:80>
ServerName nologserver.tld
ErrorLog /dev/null
CustomLog /dev/null common
</VirtualHost>

user9517
- 115,471
- 20
- 215
- 297
-
Would this work on Windows, too? – Uwe Keim May 18 '18 at 09:19
-
1@UweKeim No, I'm looking for a Windows solution as well... – TheStoryCoder Jun 13 '18 at 13:05
-
What does the `common` part do? Why does the CustomLog need to be `/dev/null common` rather than just `/dev/null`? – Pikamander2 Jan 23 '22 at 10:11
-
@Pikamander2 the documentation will reveal all and is your friend – user9517 Feb 07 '22 at 09:24
-
@user9517 - I don't see the "common" keyword listed anywhere. Which page of documentation contains info about it? – Pikamander2 Feb 07 '22 at 10:13
0
Change /etc/apache2/conf-enabled/other-vhosts-access-log.conf to following:
ErrorLog /dev/null
CustomLog /dev/null common
-
I get the following error when restarting apache after this change: Syntax error on line 71 of /etc/apache2/sites-enabled/example.com: CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause (see docs) – John Magnolia Sep 17 '11 at 08:35