在AWS ELB Django应用程序中禁用运行状况检查日志记录 [英] Disable health-check logging in AWS ELB Django Application
问题描述
我有一个在aws-elastic-beanstalk上运行的Django应用程序.我尝试禁用由运行状况检查引起的日志.健康检查已路由到单独的页面.
I have a Django application running on aws-elastic-beanstalk. I try to disable the logs caused by my health-checks. The health-checks are already routed to a seperate page.
Elastic-beanstalk使用Apache + mod_wsgi.
Elastic-beanstalk uses Apache + mod_wsgi.
以下代码是与nginx服务器一起使用的解决方案.我尝试为apache创建类似的内容.
The following code is a solution that works with nginx servers. I try to create something similar for apache.
我发现条件日志可能是适当的方法使用Apache服务器来完成.
I found out that conditional Logs are probably the appropriate way to do it with an Apache Server.
我的目录结构如下所示
/etc/httpd/
- conf
- httpd.conf # main conf
- conf.d
- wsgi.conf # virtual hosts
- additional config files
我的尝试:
files:
"/etc/httpd/conf.d/disable_health_logs.conf":
mode: "000644"
owner: root
group: root
content: |
SetEnvIf Request_URI "^/health/$" dontlog
CustomLog logs/access_log common env=!dontlog
文件已创建,但无效.我既看不到错误日志,也看不到访问日志的更改.
The file is created but it has no effect. Neither do I see error logs nor a change in the access logs.
在 httpd.conf
中已经存在以下设置:
In the httpd.conf
there is already the following setting:
CustomLog "logs/access_log" combined
我需要覆盖它吗?
推荐答案
所以我对此有另一种看法.
So I had another go on this.
问题确实出在 httpd.conf
中的设置.如果我不赞成这一行:
The problem really is the setting in the httpd.conf
. If I outcomment the line:
#CustomLog "logs/access_log" combined
通过ssh手动使用我的设置,运行状况检查从日志中消失.
manually via ssh my settings are used and the health-checks disappear from the logs.
请注意,这并不是一个永久性的解决方案,因为beantalk可能会启动一个新实例并再次覆盖httpd.conf.
Note that this is not really a permanent solution as beanstalk might spin up a new instance and override the httpd.conf again.
这篇关于在AWS ELB Django应用程序中禁用运行状况检查日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!