【发布时间】:2014-06-26 13:19:28
【问题描述】:
我正在尝试将 Apache 2.4 错误写入错误日志并使用 Python 脚本将它们发送到 Graylog2 服务器。查看http://www.fnal.gov/docs/products/apache/syslog_logs_notes.html 和http://zindilis.com/docs/apache-logs-to-remote-syslog.html 等示例。示例显示我应该使用 tee,例如:
ErrorLog "| tee -a /var/log/httpd/error_log | nc -u -j syslog.example.com 514"
我正在做以下事情:
ErrorLog "| /usr/bin/tee -a /var/log/httpd/domains/test.error.log | /usr/bin/python /opt/apache2gelf/test.py"
消息被写入日志,但不执行 python 脚本。 Python 脚本有 755 个权限。我在这里错过了什么?
【问题讨论】:
-
看起来不错。如何验证 Python 脚本没有被执行?
-
听起来好像与
tee的缓冲区有关,我自己在过去使用过它。这可能会有所帮助:stackoverflow.com/questions/11337041/… -
@Mikko 我正在写一些东西到一个文件来测试它。
-
@arco 你有我怎么做的例子吗?
-
尝试不带 tee 进行测试?