這篇文章主要介紹“Flume Interceptors怎么部署”,在日常操作中,相信很多人在Flume Interceptors怎么部署問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Flume Interceptors怎么部署”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
成都創(chuàng)新互聯(lián)主要業(yè)務(wù)有網(wǎng)站營銷策劃、成都做網(wǎng)站、成都網(wǎng)站制作、微信公眾號開發(fā)、小程序定制開發(fā)、H5頁面制作、程序開發(fā)等業(yè)務(wù)。一次合作終身朋友,是我們奉行的宗旨;我們不僅僅把客戶當(dāng)客戶,還把客戶視為我們的合作伙伴,在開展業(yè)務(wù)的過程中,公司還積累了豐富的行業(yè)經(jīng)驗、成都營銷網(wǎng)站建設(shè)資源和合作伙伴關(guān)系資源,并逐漸建立起規(guī)范的客戶服務(wù)和保障體系。
一、Timestamp Interceptor
在event headers中,添加timestamp標(biāo)簽
[root@hftest0001 conf]# pwd /opt/apache-flume-1.6.0-bin/conf [root@hftest0001 conf]# vi s-exec_c-m_s-logger.conf agent.sources = exec_tail agent.channels = memoryChannel agent.sinks = loggerSink agent.sources.exec_tail.type = exec agent.sources.exec_tail.command = tail -F /opt/flume-data/exec-tail.log agent.sources.exec_tail.channels = memoryChannel agent.sources.exec_tail.interceptors = i1 agent.sources.exec_tail.interceptors.i1.type = timestamp #agent.sources.exec_tail.interceptors.i1.preserveExisting = true agent.sinks.loggerSink.type = logger #agent.sinks.loggerSink.maxBytesToLog = 1 agent.sinks.loggerSink.channel = memoryChannel agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 100 ===>結(jié)果 Event: { headers:{timestamp=1452668731658} body: 78 78 xx }
二、Host Interceptor
獲取agent部署那臺server的ip或是hostname,或添加到host標(biāo)簽中
[root@hftest0001 conf]# pwd /opt/apache-flume-1.6.0-bin/conf [root@hftest0001 conf]# vi s-exec_c-m_s-logger.conf agent.sources.exec_tail.type = exec agent.sources.exec_tail.command = tail -F /opt/flume-data/exec-tail.log agent.sources.exec_tail.channels = memoryChannel agent.sources.exec_tail.interceptors = i1 i2 agent.sources.exec_tail.interceptors.i1.type = timestamp #agent.sources.exec_tail.interceptors.i1.preserveExisting = true agent.sources.exec_tail.interceptors.i2.type = host #agent.sources.exec_tail.interceptors.i2.userIP = false =>default:true 設(shè)置為false,則獲取的值為hostname #agent.sources.exec_tail.interceptors.i2.hostHeader = hostname => default:header中key為host,可以設(shè)置更改 #agent.sources.exec_tail.interceptors.i2.preserveExisting = true agent.sinks.loggerSink.type = logger #agent.sinks.loggerSink.maxBytesToLog = 1 agent.sinks.loggerSink.channel = memoryChannel agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 100 ===>result Event: { headers:{timestamp=1452669139164, host=${ip}} body: 78 78 xx }
三、Static Interceptor
自定義向header中添加k-v: 用途,如想知道events是那個dc的,那個country,那個city。也可以根據(jù)這些header信息,進(jìn)行數(shù)據(jù)分流等等
[root@hftest0001 conf]# pwd /opt/apache-flume-1.6.0-bin/conf [root@hftest0001 conf]# vi s-exec_c-m_s-logger.conf #agent.sources.exec_tail.interceptors.i2.userIP = false #agent.sources.exec_tail.interceptors.i2.hostHeader = hostname #agent.sources.exec_tail.interceptors.i2.preserveExisting = true agent.sources.exec_tail.interceptors.i3.type = static agent.sources.exec_tail.interceptors.i3.key = country agent.sources.exec_tail.interceptors.i3.value = USA agent.sources.exec_tail.interceptors.i4.type = static agent.sources.exec_tail.interceptors.i4.key = city agent.sources.exec_tail.interceptors.i4.value = NEW_YORK agent.sinks.loggerSink.type = logger #agent.sinks.loggerSink.maxBytesToLog = 1 agent.sinks.loggerSink.channel = memoryChannel agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 100 ===> result Event: { headers:{timestamp=1452669538967, host=${IP}, city=NEW_YORK, country=USA} body: 78 78 xx }
到此,關(guān)于“Flume Interceptors怎么部署”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
網(wǎng)站標(biāo)題:FlumeInterceptors怎么部署
轉(zhuǎn)載源于:http://weahome.cn/article/igjhci.html