Apache 记录一个导致错误的 access.log 文件
Apache Logging one result in wrong access.log file
我通过 vhost.conf 创建了多个 CustomLog 文件(为不同网站创建的日志),因此它们并未全部记录在 access.log
在此基础上,我更进了一步,在该网站上隔离了一个文件夹,并单独记录该信息,以便跟踪使用情况。
代码;删除了一些 SetEnvIf Request_URI(比如 css 和 js 的)以便于阅读。
<VirtualHost *:80>
ServerAdmin support@domain.com
DocumentRoot "/var/www/domain.com"
ServerName domain.com
ServerAlias www.domain.com
ErrorLog "/var/www/domain_apache_error.log"
## flag image requests
SetEnvIf Request_URI "(\.gif|\.png|\.jpg)$" image-request=nolog
## flag folder calls
SetEnvIf Request_URI "^/folder/" folder-request=nolog
## set do_not_log if any of the above flags are set
SetEnvIf image-request nolog do_not_log
SetEnvIf folder-request nolog do_not_log
## only log if do_not_log is not set
CustomLog "/var/www/domain_folder_access.log" common env=folder-request
CustomLog "/var/www/domain_access.log" common env=!do_not_log
</VirtualHost>
一切都很好,只有一个例外。看起来好像一个特定的结果被缓存并且仍然被记录在 access.log 文件中。
示例:
/folder/12/file-name.php
/folder/13/file-name.php
/folder/14/file-name.php
/folder/15/file-name.php
/folder/17/file-name.php
都在记录,就像他们应该的那样,在domain_folder_access.log
/folder/16/file-name.php
仍然出现在 access.log
所以,.. 我正在使用 apache,Windows/Wamp。它看起来好像 /folder/16/file-name.php 不知何故 'cached' 并且它被记录在错误的文件中。清除信息以便正确记录文件的过程是什么。 (我试过重新启动)其他一切都在正常工作。
观看 access.log 并看到 'few' 其他文件被记录到 access.log 文件后,我开始意识到那些被记录的文件来自本网站的安全版本。即 https 与 http
更新 config/extra/httpd-ssl.conf 文件以使用相同的 SetEnvIf 结构更正了该问题。
..仅供可能遇到相同问题的其他人参考。
我通过 vhost.conf 创建了多个 CustomLog 文件(为不同网站创建的日志),因此它们并未全部记录在 access.log
在此基础上,我更进了一步,在该网站上隔离了一个文件夹,并单独记录该信息,以便跟踪使用情况。
代码;删除了一些 SetEnvIf Request_URI(比如 css 和 js 的)以便于阅读。
<VirtualHost *:80>
ServerAdmin support@domain.com
DocumentRoot "/var/www/domain.com"
ServerName domain.com
ServerAlias www.domain.com
ErrorLog "/var/www/domain_apache_error.log"
## flag image requests
SetEnvIf Request_URI "(\.gif|\.png|\.jpg)$" image-request=nolog
## flag folder calls
SetEnvIf Request_URI "^/folder/" folder-request=nolog
## set do_not_log if any of the above flags are set
SetEnvIf image-request nolog do_not_log
SetEnvIf folder-request nolog do_not_log
## only log if do_not_log is not set
CustomLog "/var/www/domain_folder_access.log" common env=folder-request
CustomLog "/var/www/domain_access.log" common env=!do_not_log
</VirtualHost>
一切都很好,只有一个例外。看起来好像一个特定的结果被缓存并且仍然被记录在 access.log 文件中。
示例:
/folder/12/file-name.php
/folder/13/file-name.php
/folder/14/file-name.php
/folder/15/file-name.php
/folder/17/file-name.php
都在记录,就像他们应该的那样,在domain_folder_access.log
/folder/16/file-name.php
仍然出现在 access.log
所以,.. 我正在使用 apache,Windows/Wamp。它看起来好像 /folder/16/file-name.php 不知何故 'cached' 并且它被记录在错误的文件中。清除信息以便正确记录文件的过程是什么。 (我试过重新启动)其他一切都在正常工作。
观看 access.log 并看到 'few' 其他文件被记录到 access.log 文件后,我开始意识到那些被记录的文件来自本网站的安全版本。即 https 与 http
更新 config/extra/httpd-ssl.conf 文件以使用相同的 SetEnvIf 结构更正了该问题。
..仅供可能遇到相同问题的其他人参考。