久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Flume Interceptors怎么部署

187次閱讀
沒有評論

共計 3210 個字符,預計需要花費 9 分鐘才能閱讀完成。

這篇文章主要介紹“Flume Interceptors 怎么部署”,在日常操作中,相信很多人在 Flume Interceptors 怎么部署問題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Flume Interceptors 怎么部署”的疑惑有所幫助!接下來,請跟著丸趣 TV 小編一起來學習吧!

一、Timestamp Interceptor

在 event headers 中,添加 timestamp 標簽

[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
=== 結果
Event: { headers:{timestamp=1452668731658} body: 78 78 xx }

二、Host Interceptor

獲取 agent 部署那臺 server 的 ip 或是 hostname,或添加到 host 標簽中

[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  設置為 false,則獲取的值為 hostname
#agent.sources.exec_tail.interceptors.i2.hostHeader = hostname =  default:header 中 key 為 host, 可以設置更改
#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。也可以根據這些 header 信息,進行數據分流等等

[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 }

到此,關于“Flume Interceptors 怎么部署”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注丸趣 TV 網站,丸趣 TV 小編會繼續努力為大家帶來更多實用的文章!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-16發表,共計3210字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 广河县| 乌审旗| 永定县| 枣阳市| 黔南| 丹棱县| 晋江市| 巴青县| 上虞市| 镇康县| 驻马店市| 盐池县| 淮北市| 昌宁县| 赣榆县| 应城市| 德江县| 灵石县| 靖江市| 南靖县| 淮阳县| 枣阳市| 阳西县| 宁津县| 吉首市| 咸宁市| 广丰县| 枣阳市| 东港市| 辉南县| 镇沅| 延长县| 涟源市| 太仓市| 格尔木市| 会同县| 苗栗市| 湖南省| 桃园县| 上饶县| 溆浦县|