Application System Log collection solution and log collection solution

Source: Internet
Author: User

Application System Log collection solution and log collection solution
Overview

Use Flume + MongoDB to collect logs from multiple existing application systems. Feature data flow diagram Note: The first architecture is to directly write log data to Flume in the application system. However, existing application systems are non-Maven, you need to add more than 20 jar packages to each application system. In order to avoid this situation, a layer of Log service is provided to open the webservice Service for application system calls, and the above system is formed. Log storage 1. problem to be solved 1.1 Use Flume to write logs to MongoDB reference: Flume Learning application: Java to write log data to MongoDB-Internet Reference: Flume Learning application: Java to write log data to MongoDB1.2 release webservice reference: release jaxws-Internet reference in a web project: Release jaxws2. Log service in a web project to implement a simple web project. Release a webservice to write logs to Flume. 2.1 file structure
Src/main/java | ---- cn. sinobest. asj. log | ---- ISALog. java # Log Service Interface | ---- SALogImpl. java # Log service implementation class | ---- cn. sinobest. asj. log. exception | ---- InvalidGradeException. java # indicates invalid Log Level | ---- InvalidFormatExceptioin. java # indicates Invalid Message format (JSON string is required) | ---- cn. sinobest. asj. log. util | ---- ValidGrade. java # enumeration, all valid log levels (DEBUG, INFO, WARN, ERROR) | ---- MessageTemplate. java # message template src/main/resources | ---- log4j. propertiessrc/main/webapp | ---- WEB-INF | ---- sun-jaxws.xml | ---- web. xml | ---- index. jsp # This can ignore pom. xml

 

2.2 you can directly obtain the source code from log-service and skip the content in this section. Application System Group 1. question to consider: 1.1 interception can be achieved by using Filter. 1.2 The organization log content depends on the requirements. Currently, only some information in the request is collected. 1.3 formatting log information must be formatted as a JSON string to be correctly written to MongoDB. 1.4 request for the webservice Service reference: clients that generate code based on wsimport-Internet Reference: clients that generate code based on wsimport 2. demo2.1 file structure
Src | ---- cn. sinobest. asj. log | ---- LogFilter. java | ---- cn. sinobest. asj. log. wsimport # store wsimport generated code # omitted basic | ---- WEB-INF | ---- web. xml
2.2 file content test Appendix Related Articles

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.