Flume - 如何定期或在达到一定大小时读取日志

Flume - how to read logs on regular interval or when reaches some size

我想知道,是否可以配置 Flume 以固定时间间隔或当日志达到一定大小时读取日志,以及如何?提前致谢

Flume to read logs regular interval of time or when the logs reaches certain size and How?

代理商将持续 运行 这是 flume 的功能。因此,在任何间隔日志或消息即将到来...... flume 能够捕获这些。

如果你想检查传入消息或日志的大小,你必须编写 FlumeSource 即 (public class FlumeSource extends AbstractSource implements Configurable, EventDrivenSource) ,它将在源头捕获日志并打印大小。 你可以使用

LOG.info("Processing message...with size = " + FileUtils.byteCountToDisplaySize(bytes.length));

其中 FileUtils 是 apache commons class & byteCountToDisplaySize 是用于显示人类可读的方式。

要将事件日志序列化到 hbase,您可以使用 AsyncHbase 编写自定义序列化程序 api。