本篇内容主要讲解“Flume如何收集日志到本地目录”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Flume如何收集日志到本地目录”吧!
例子场景描述:
将tomcat的日志收集到指定的目录,tomcat 安装在/opt/tomcat, 日志存放在var/log/data
技术选型 exec - file - file_roll
# A single-node Flume configuration# Name the components on thisagentagent1.sources = source1agent1.sinks = sink1agent1.channels = channel1# Describe/configure source1agent1.sources.source1.type = execagent1.sources.source1.command = tail -n +0 -F /opt/tomcat/logs/catalina.outagent1.sources.source1.channels = channel1# Describe sink1agent1.sinks.sink1.type = file_rollagent1.sinks.sink1.sink.directory=/var/log/data# Use a channel which buffers events in memoryagent1.channels.channel1.type = fileagent1.channels.channel1.checkpointDir=/var/checkpointagent1.channels.channel1.dataDirs=/var/tmpagent1.channels.channel1.capacity = 1000agent1.channels.channel1.transactionCapactiy = 100# Bind the source and sink to the channelagent1.sources.source1.channels = channel1agent1.sinks.sink1.channel = channel1
到此,相信大家对“Flume如何收集日志到本地目录”有了更深的了解,不妨来实际操作一番吧!这里是编程网网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!