Flume Practical Application Analysis

Source: Internet
Author: User

Business background:

The output of the log files generated by the Java project to flume


The first step:

Output the log to flume, write the log4j in the Java program, and specify the output to which Flume server

Log4j.rootlogger=info,flumelog4j.appender.flume= Org.apache.flume.clients.log4jappender.log4jappenderlog4j.appender.flume.hostname= 192.168.13.132log4j.appender.flume.port=41414


Step Two:

Import Java.util.date;import Org.apache.log4j.logger;public class Flume {public static final Logger Logger = Logger.getlo Gger (flume.class);p ublic static void Main (string[] args) throws Exception {while (true) {Logger.info (string.valueof (new Date (). GetTime ())); Thread.Sleep (2000);}}


Step Three:

Reference

Case 15:avro Load Balancer dynamically gets the contents of the file in start 132 and 133, you can also specify the priority, reference case 17:avro load balancer plus priority configuration


For example, three different logs are generated on different servers, such as 132 generated by Access 133 is generated by the Ugcheader can be


Log4j.rootlogger=info,access, Ugcheader log4j.appender.access = Org.apache.flume.clients.log4jappender.Log4jAppenderlog4j.appender.access. Hostname=192.168.13.132log4j.appender.access. port=41414


Log4j.rootlogger=info,access, Ugcheader Log4j.appender.ugcheader = Org.apache.flume.clients.log4jappender.Log4jAppenderlog4j.appender.ugcheader. Hostname=192.168.13.133log4j.appender.ugcheader. port=41414



Flume Practical Application Analysis

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.