Tomcat access log记录到mongo的插件 Tomcat Mongo Access Log Valve

码农软件 · 软件分类 · 日志工具(Logging) · 2019-09-20 18:57:29

软件介绍

Tomcat Mongo Access Log 是一个将 Tomcat access log 记录到 MongoDB 的插件。

特性:

  1. 不影响业务代码
  2. 使用简单

使用方式和Tomcat自带的AccessLogValve基本一致,只需要简单配置就能够实现将日志存入到mongodb。

使用前先mvn clean package,把jar包放到$TOMCAT_HONE/lib/目录下。然后替换掉server.xml中原来的AccessLogValve配置:

<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
       prefix="localhost_access_log." suffix=".txt"
      pattern="%h %l %u %t &quot;%r&quot; %s %b" />
-->
<Valve 
    className="chanjarster.tomcat.valves.MongoAccessLogValve" 
    uri="mongodb://url/to/mongodb"
    pattern="all" />

然后启动tomcat,就可以了。

如果要查询tomcat产生的日志,可以使用这个项目:https://github.com/chanjarster/tomcat-mongo-access-log-console

详细使用方式可见项目主页README.



本文地址:https://codercto.com/soft/d/15032.html

The Starfish and the Spider

The Starfish and the Spider

Ori Brafman、Rod A. Beckstrom / Portfolio Hardcover / 2006-10-05 / USD 24.95

Understanding the amazing force that links some of today's most successful companies If you cut off a spider's leg, it's crippled; if you cut off its head, it dies. But if you cut off a st......一起来看看 《The Starfish and the Spider》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器