关于tomcat日志记录的问题
我读到,作为一种良好的安全实践,启用使用日志来识别攻击源等是很好的。
使用 AccessLogValve
可以实现这一点。
我的问题是是否有人有使用它的经验以及它是否对生产性能有任何影响 环境。
谢谢
I have read that as a good security practice it is good to enable usage logs to identify source of attacks etc.
This can happen using AccessLogValve
.
My question is if anyone has experience in using this and if it has any affect on performance in production
environments.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,有性能指标。
它的影响有多大取决于您的网站支持的容量。如果您每分钟有数千个请求,那么这可能不是一个好主意。
早期版本的一些问题已在 Tomcat 邮件列表上讨论< /a>
Tomcat 还在 5.5 中引入了 FastCommonAccessLogValve,但似乎从 6 开始已弃用。
您可以做的是过滤您希望记录的请求模式或 IP 地址(如果可能出现这样的用例),然后仅记录这些。这不是使用内置阀门,而是使用自定义过滤器。尝试任何对你有用的东西
Yes, there are performance indications.
How much of an impact it has depends on the volumetrics your site supports. If you have thousands of requests per minute, then it's probably not a great idea.
Some issues with earlier versions have been discussed on Tomcat mailing lists
Tomcat also introduced a FastCommonAccessLogValve in 5.5 but it seems to be deprecated from 6 onwards.
What you can do instead is to Filter the request patterns or IP addresses which you wish to log (if such a use case is possible) and then only log those. This is not using the inbuilt Valve but a custom Filter. Try whatever works for you
日志包含的数据越多,日志写入访问就会越慢。您需要确保
记录
您的访问日志并使其过时。在 Linux 机器上,大多数时候都有一个像“logrotated”这样的守护进程,如果配置正确的话,它会管理日志大小和轮换。Log write-access will be slower the more data the log contains. You need to make sure that you
logrotate
your accesslogs and outdate them. On a linux machine there is most of the times a daemon like "logrotated" which manages log sizes and rotation if configured properly.您所做的任何事情都会影响性能。在某些情况下,您必须使用访问日志。如果您针对 Web 服务器运行 JMeter,则可以衡量影响。您会发现影响不会挂起您的系统或发生任何戏剧性的事情...
这种影响取决于太多因素,因此自行测量会给您一个明确的结果。毕竟访问日志文件是为了在生产环境中使用的。
我们一直使用电子商店的访问日志文件。它们提供有用的用户访问行为信息。标记也会影响性能。不过,如果您想要更高的准确性,您可能必须同时使用这两种方法。
丰富的 Internet 应用程序和 Ajax 疏远了访问方案,将更多的处理工作交给客户端的浏览器。 GWT 应用程序即使 tomcat 访问文件变得无用,并且需要进行标记。
根据 数据仓库原则。
Anything you do has impact on performance. There are situations that force you to use an access log. You can measure the impact if you run JMeter against your web server. You will see that the impact does not hang your system or anything dramatic...
This impact depends on too many factors, so measuring yourself will give you a clear result. After all the access log files are meant to be used in production environments.
We use access log files for e-shops all the time. They provide useful user access behavioral information. Tagging has an impact on performance as well. Still if you want higher accuracy you may have to use both methods simultaneously.
Rich Internet Applications and Ajax alienate the access scheme, placing more processing to the browser of your client. GWT application i.e. render the tomcat access file useless and tagging will be necessary.
Make your log files rotatable in order to keep them in reasonable sizes and ftp them to another system in order to process them, according to the Data Warehouse principles.