flume-ng interceptors
来源:互联网 发布:软件开发工程师职称 编辑:程序博客网 时间:2024/06/05 18:16
flume-ng interceptors 可以理解为一个过滤器,通过配置可以收集到符合自己需要类型的日志
官网提供了以下几种interceptors:
Timestamp Interceptor
在event的header中添加一个key叫:timestamp,value为当前的时间戳
Example for agent named a1:
Host Interceptor
在event的header中添加一个key叫:host,value为当前机器的hostname或者ip
Example for agent named a1:
Static Interceptor
可以在event的header中添加自定义的key和value。
Example for agent named a1:
UUID Interceptor
Morphline Interceptor
Sample flume.conf file:
Search and Replace Interceptor
Example configuration:
Another example:
Regex Filtering Interceptor
通过正则来清洗或包含匹配的events。
Regex Extractor Intercepto
通过正则表达式来在header中添加指定的key,value则为正则匹配的部分
Example 1:
If the Flume event body contained 1:2:3.4foobar5 and the following configuration was used
The extracted event will contain the same body but the following headers will have been added one=>1, two=>2, three=>3
Example 2:
If the Flume event body contained 2012-10-18 18:47:57,614 some log line and the following configuration was used
上面是官网提供的demo:
这里我简单介绍一下经常使用的 regex_filter
在配置中新增interceptors:
下面是给了两个正则 ,作为两个例子进行实现 其中 i1 是 匹配正则 i2 是匹配类似 d:d:d 格式的日志
a1.sources.source1.interceptors=i2a1.sources.source1.interceptors.i1.type=regex_filter a1.sources.source1.interceptors.i1.regex=\\{.*\\} a1.sources.source1.interceptors.i2.type=regex_filter a1.sources.source1.interceptors.i2.regex = (\\d):(\\d):(\\d)a1.sources.source1.interceptors.i2.serializers = s1 s2 s3a1.sources.source1.interceptors.i2.serializers.s1.name = onea1.sources.source1.interceptors.i2.serializers.s2.name = twoa1.sources.source1.interceptors.i2.serializers.s3.name = three
其他的配置请看上一篇日志 http://blog.csdn.net/linlinv3/article/details/50053333;
在上一篇的日志中加入 interceptors;
若是不加interceptors 采集到的日志是 WriteLog所有的:
若是加上i1后 日志只有 1:2:3
若是使用i2 则日志只有 那串json串
- flume-ng interceptors
- Flume Interceptors
- Flume NG 学习笔记(八)Interceptors(拦截器)测试
- flume七:Flume Interceptors介绍
- 7.Flume Interceptors
- Flume Interceptors的使用
- Flume Interceptors的使用
- flume-ng
- Flume NG
- flume ng
- Flume-ng
- Flume OG & Flume NG
- flume学习:Flume Interceptors的使用
- flume OG VS flume NG
- FLume NG 开发环境
- Flume NG configuration sample
- Flume NG 配置详解
- flume-ng 使用系列
- AngularJS进阶(十二)AngularJS常用知识汇总(不断更新中....)
- AlertDialog应用——App退出提示框
- Android调用相机保存图片到相册
- WinDbg 调试dmp文件
- 内部排序-插入排序-希尔排序
- flume-ng interceptors
- C++primer_泛型算法-插入迭代器和iostream迭代器
- jdk安装
- Struts2工作原理
- hiveServer2 挂起处理
- CCS5.5里DSP工程建及Simulator模式配置
- 学习log4j
- java中cookie的操作
- 阻碍成长的几件小事