Изменение каталога файлов журналов Apache 2.4.x на Centos 7

В настоящее время мои файлы журнала доступны в каталоге / var / log / httpd /. Поскольку у меня ограниченное количество корневого раздела, количество журналов превышает лимит, что приводит к зависанию системы.

Я хочу изменить каталог журналов apache на другой смонтированный том.

Я не изменил и не нашел ничего о каталоге файла журнала в файле конфигурации, что будет самый простой способ изменить каталог / var / log / http / * на / someRandomVolume / httpLogFolder / *

Это то, что у меня есть о журнале в моем файле конфигурации;

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    #CustomLog "logs/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    CustomLog "logs/access_log" combined
</IfModule>
1
задан 27 September 2017 в 12:49
1 ответ

В RHEL / CentOS расположение файлов журналов по умолчанию относительно базового каталога ServerRoot / etc / httpd / и обычно является символической ссылкой из / etc / httpd / logs в / var / log / httpd .

Если вы хотите использовать другой каталог, просто переместите / var / log / httpd и обновите эту символическую ссылку.

В качестве альтернативы, как предложил @TomTomTom, используйте абсолютные пути в директивах CustomLog и ErrorLog .

Если у вас включен SELinux, убедитесь, что установлен / сохранен правильный контекст для этого нового каталога.

2
ответ дан 3 December 2019 в 20:19

Теги

Похожие вопросы