目前我的日志文件在`/ var / log / httpd /下是可用的。 由于我的根分区数量有限,日志超出限制,导致系统卡住。
我想将apache日志目录更改为另一个已安装的卷。
我没有改变,发现任何关于日志文件目录在configuration文件中,将/var/log/http/*目录更改为/someRandomVolume/httpLogFolder/*最简单的方法是什么?
这是我有关于login我的configuration文件;
# # 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>
在RHEL / CentOS上,日志文件的默认位置与ServerRoot基本目录/etc/httpd/ ,通常是从/etc/httpd/logs到/var/log/httpd的符号链接。
如果要使用不同的目录,只需移动/var/log/httpd并更新该符号链接。
或者,如@TomTomTombuild议,在CustomLog和ErrorLog指令中使用绝对path。
如果您启用了SELinux,请确保为该新目录设置/保留正确的上下文。