Giter VIP home page Giter VIP logo

influxdb-tomcat-accesslog's Introduction

influxdb-tomcat-accesslog

A Tomcat Access Log Valve that will log to an InfluxDB database.

This implementation aims to add influxdb support to the Tomcat Access Log Valve Component.

Tomcat's default Access Log Valve logs the access logs to the logs/localhost_access_log.TIMESTAMP.txt file.

Configuration

Add the following section to Tomcat's server.xml file.

You can either keep, or replace the default access log org.apache.catalina.valves.AccessLogValve.

TCP mode:

        <Valve className="com.cbnt.influxdb.InfluxDBAccessLogValve" 
          connectionName="root"
      connectionPassword="root" 
           connectionURL="http://localhost:8086/" 
            databaseName="mydatabase"
               seriesName="httpAccessLogs" 
                  pattern="combined" />

UDP mode

        <Valve className="com.cbnt.influxdb.InfluxDBAccessLogValve" 
          connectionName="root"
      connectionPassword="root" 
           connectionURL="http://localhost:8086/"
               transport="UDP"
                 udpPort="4444" 
               seriesName="httpAccessLogs" 
                  pattern="combined" />

Sample Data

An example of a request logged with influxdb-tomcat-accesslog:

time sequence_number remoteHost userName query bytes virtualHost status method referer userAgent
1433192553974 155500001 127.0.0.1 /docs/images/asf-feather.png 0 localhost 304 GET http://localhost:8080/docs/security-howto.html Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
1433192553963 155490001 127.0.0.1 /docs/images/tomcat.png 0 localhost 304 GET http://localhost:8080/docs/security-howto.html Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
1433192553946 155480001 127.0.0.1 /docs/images/fonts/fonts.css 0 localhost 304 GET http://localhost:8080/docs/images/docs-stylesheet.css Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0

Build

  • Java 1.6+
  • Maven 3.0+

Buid with maven:

$ mvn clean install

After the build is done, drop the following jars inside TOMCAT_HOME/lib folder:

  • influxdb-tomcat-accesslog-0.1-SNAPSHOT.jar
  • guava-18.0.jar
  • okhttp-2.0.0.jar
  • okhttp-urlconnection-2.0.0.jar
  • gson-2.3.jar
  • okio-1.0.0.jar
  • influxdb-java-1.5.jar

This implementation is still on early development days and hasn't been published yet to any public maven repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.