linux - 如何在 apache 日志的文件名中包含服务器名称?

标签 linux apache filenames logging

我想配置apache,使apache include产生的访问和错误日​​志命名如下:

<server-name>_access_<timestamp>
<server-name>_error_<timestamp>

我使用 rotatelogs 计算出时间戳部分:

CustomLog logs/access_log combined
CustomLog "|bin/rotatelogs -l /var/logs/access_%Y-%m-%d 86400" common

我无法弄清楚的部分是如何在文件名中包含服务器名称。我正在 linux 机器上配置 Apache。

问候, 磨憨

最佳答案

似乎就 Apache HTTPD 2.4 而言,没有任何功能提供此功能。

http://httpd.apache.org/docs/current/mod/mod_log_config.html#customlog

如果您想要一些棘手的事情,您可以使用类似于您完成时间戳问题的方式的管道,并让脚本尝试确定 VirtualHost。不确定您将如何完成。

关于linux - 如何在 apache 日志的文件名中包含服务器名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3086926/

相关文章:

linux - libnl-3 包括损坏的?

python - 在线程崩溃时自动生成到 STDERR 的完整堆栈跟踪

apache - 来自单个目录的多个 .htpasswd 文件的源密码

go - Go 有文件名限制吗?

python - 匹配文件名后撤消 files.split (python 3.x)

python - 完全丢失: Python configure script runs with errors

linux - 查找字符串并添加字符串

php - 如何放宽 PHP 的 open_basedir 限制?

apache - 如何使用 lua 获取 HTTP 响应体?

javascript - 如果文件名太长,在 Firefox 控制台中看不到行号