Flume總結(1)

來源:互聯網
上載者:User

標籤:採集   檔案   add   address   connect   roo   local   ted   log   

一、日誌採集:從網路連接埠接收資料,下沉到logger

檔案netcat-logger.conf:

 1 # Name the components on this agent 2 #給那三個組件取個名字 3 a1.sources = r1 4 a1.sinks = k1 5 a1.channels = c1 6  7 # Describe/configure the source 8 #類型, 從網路連接埠接收資料,在本機啟動, 所以localhost, type=spoolDir採集目錄源,目錄裡有就采 9 a1.sources.r1.type = netcat10 a1.sources.r1.bind = localhost11 a1.sources.r1.port = 4444412 13 # Describe the sink14 a1.sinks.k1.type = logger15 16 # Use a channel which buffers events in memory17 #下沉的時候是一批一批的, 下沉的時候是一個個eventChannel參數解釋:18 #capacity:預設該通道中最大的可以儲存的event數量19 #trasactionCapacity:每次最大可以從source中拿到或者送到sink中的event數量20 a1.channels.c1.type = memory21 a1.channels.c1.capacity = 100022 a1.channels.c1.transactionCapacity = 10023 24 # Bind the source and sink to the channel25 a1.sources.r1.channels = c126 a1.sinks.k1.channel = c1

啟動命令:
#告訴flum啟動一個agent,指定配置參數, --name:agent的名字,
flume-ng agent --conf conf --conf-file conf/netcat-logger.conf --name a1 -Dflume.root.logger=INFO,console

傳入資料:

[[email protected] ~]# telnet localhost 44444Trying ::1...telnet: connect to address ::1: Connection refusedTrying 127.0.0.1...Connected to localhost.Escape character is ‘^]‘.hello world!^H^H^H^H^H^H^H^H^H^H^H^H^H^HOKtianjun2012!OK
控制台看到的資料
2017-05-08 13:41:35,766 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:94)] Event: { headers:{} body: 68 65 6C 6C 6F 20 77 6F 72 6C 64 21 08 08 08 08 hello world!.... }2017-05-08 13:41:40,153 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:94)] Event: { headers:{} body: 74 69 61 6E 6A 75 6E 32 30 31 32 21 0D tianjun2012!. }

 

Flume總結(1)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.