22

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?

3 Answers 3

40

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>
5
  • Would this work on Windows, too?
    – Uwe Keim
    May 18, 2018 at 9:19
  • 1
    @UweKeim No, I'm looking for a Windows solution as well... Jun 13, 2018 at 13:05
  • What does the common part do? Why does the CustomLog need to be /dev/null common rather than just /dev/null? Jan 23, 2022 at 10:11
  • @Pikamander2 the documentation will reveal all and is your friend
    – user9517
    Feb 7, 2022 at 9:24
  • @user9517 - I don't see the "common" keyword listed anywhere. Which page of documentation contains info about it? Feb 7, 2022 at 10:13
0

Change /etc/apache2/conf-enabled/other-vhosts-access-log.conf to following:

ErrorLog /dev/null

CustomLog /dev/null common
1
  • 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) Sep 17, 2011 at 8:35
0

On Ubuntu

sudo a2disconf other-vhosts-access-log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .