如何为不同的 HTML URL 路径生成单独的日志? [英] How can I generate seperate logs for different HTML URL paths?

查看:28
本文介绍了如何为不同的 HTML URL 路径生成单独的日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据目录访问来突破我网站的日志记录,因此我正在寻求对此答案的详细说明(或此 answer):建议的答案放在哪个文件中?

I'm trying to breakout the logging of my website based on directory access, so I'm seeking an elaboration to this answer (or this answer too): In which file do place the suggested answer?

我将以下内容放入我的 /etc/apache2/apache2.conf(实际上是通过 Include my-logging.conf):

I put the following in my /etc/apache2/apache2.conf (actually via an Include my-logging.conf):

SetEnvIf Request_URI "^/download/.+$" download_access
CustomLog /home/jamie/apache-logs/download.log common env=download_access

目录 /home/jamie/apache-logs/ 及其中的文件是普遍可写的,但是当我通过浏览器访问资源时 (http://download/index.html)html) 主访问日志 (/var/log/access.log) 已更新,但不是我希望的日志: /home/jamie/apache-logs/download.log 保持不变.

The directory /home/jamie/apache-logs/ and the files therein are universally writable, but when I access the resource via my browser (http://download/index.html) the main access log (/var/log/access.log) is updated but not the log I was hoping would be: /home/jamie/apache-logs/download.log remains untouched.

我有理由确定 mod_setenvif 已经启用:

I'm reasonably certain mod_setenvif is already enabled:

$ sudo a2enmod setenvif
Module setenvif already enabled

我怎样才能做到这一点?

How can I make this work?

推荐答案

Head Slap!

正则表达式错误:

SetEnvIf Request_URI "^/download/.+$" download_access

应该是:

SetEnvIf Request_URI "^/download/.*$" download_access

注意 *+.

这篇关于如何为不同的 HTML URL 路径生成单独的日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆