Flume从syslogudp源中删除所有标记

wrrgggsh  于 2021-06-04  发布在  Flume
关注(0)|答案(2)|浏览(350)

我正在使用带有syslogudp源代码的apacheflume。我在flume.conf中设置了以下内容:

agent.sources.r1.type = syslogudp
agent.sources.r1.port = 5140
agent.sources.r1.host = localhost
agent.sources.r1.channels = c1

以及以下nginx.conf选项:

access_log syslog:server=localhost,tag= ;

因此,我在sink中的所有日志(kafka主题)的开头都有2个符号。例如:

: 31.130.95.75  1472493421.911  80674   {flags}

有没有办法切断第一个冒号和空格符号?
谢谢

laawzig2

laawzig21#

你可能想看看搜索和替换拦截器(https://flume.apache.org/flumeuserguide.html#search-更换拦截器)
可以使用拦截器使用正则表达式编辑事件体。
在您的示例中,修改后的配置如下所示:

agent.sources.r1.type = syslogudp
agent.sources.r1.port = 5140
agent.sources.r1.host = localhost
agent.sources.r1.channels = c1

agent.sources.r1.interceptors = search-replace
agent.sources.r1.interceptors.search-replace.type = search_replace

agent.sources.r1.interceptors.search-replace.searchPattern = ^.*:
agent.sources.r1.interceptors.search-replace.replaceString =
sg24os4d

sg24os4d2#

在我的情况下nginx:开始
nginx:2016-08-27t18:21:59+08:00“14.88.133.152”14.88.133.152“get”api..com“/mobile/member/user/bind/push”http/1.1“-”dalvik/2.1.0(linux;u;安卓5.0.2;htc 802t构建/lrx22g)802t构建/lrx22g)“1141”200“370”31“31”127.0 0.1:9000“0.00”——“0.082”0.080“建立”htc 802t构建/lrx22g”802t构建/lrx22g”200“20”200“20”200“200”200“200”370”37“31”31“31”127“127.0.0.0 0 0 0 0“0.0”0“0.0”0“0.082”0“0”0“0”8“g7/rxu9nj++++的工作,7/E6个国家的工作,包括包括7个国家的“7个国家的“7个工作,包括8个国家的工作,8个国家的VDJqqqq1 R4个需求,18 18个国家的18个国家的18个国家的数据,有的有的有的有的有的有的有的有的有的有的有的有的“app”app=a-angejia;av=4.0.1;ccid=1;gcid=;ch=b48;液化天然气=;纬度=;网络=wifi;p=机器人;pm=android htc 802t;osv=5.0.2;dvid=3558670539334084:7a:88:7f:0b:18“-“4000”2000“10”28280

相关问题