方法1:一实例多topic:

https://discuss.elastic.co/t/filebeat-5-0-output-to-kafka-multiple-topics/67934

The document_type per prospector becomes the event field type. That's why the filter won't match.

Instead of conditionals consider using the format string like:

filebeat.prospectors:
- ...
document_type: myapp_applog
- ...
document_type: myapp_applog_stats
- ...
document_type: myapp_elblog output.kafka:
topic: '%{[type]}' # use document_type to set topic btw. the topic field in conditionals also supports format strings.
cat filebeat.yml

output.kafka:
enabled: true
hosts: ["192.168.111.107:9092","192.168.111.108:9092","192.168.111.109:9092"]
topic: '%{[type]}' filebeat.prospectors:
#------------------------------ Log prospector --------------------------------
- paths:
- /data/logs/financial-manager/server0.log
fields:
app_id: financial-manager
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}\s(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d\.'
multiline.negate: true
multiline.match: after
document_type: log-log4j - paths:
- /data/logs/user-service/*.log
fields:
app_id: user-service
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}\s(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d\.'
multiline.negate: true
multiline.match: after
document_type: log-iis - paths:
- /data/logs/financial-manager/access_log.log
fields:
app_id: financial-manager
document_type: log-undertow

方法二:多filebeat实例,每个filebeat实例设置一个topic

运行多个filebeat实例,每个实例对应一个配置文件

cat filebeat.yml

output.kafka:
enabled: true
hosts: ["192.168.111.107:9092","192.168.111.108:9092","192.168.111.109:9092"]
topic: log-log4j filebeat.prospectors:
#------------------------------ Log prospector --------------------------------
- paths:
- /data/logs/subscribe-consumer/server0.log
fields:
app_id: subscribe-consumer multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}\s(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d\.'
multiline.negate: true
multiline.match: after
cat filebeat2.yml

output.kafka:
enabled: true
hosts: ["192.168.111.107:9092","192.168.111.108:9092","192.168.111.109:9092"]
topic: log-tomcat filebeat.prospectors:
#------------------------------ Log prospector --------------------------------
- paths:
- /data/logs/subscribe-consumer/server0.log
fields:
app_id: subscribe-consumer multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}\s(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d\.'
multiline.negate: true
multiline.match: after

一个filebeat实例 设置多topic设置的更多相关文章

  1. 每天一个JavaScript实例-展示设置和获取CSS样式设置

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  2. 实例讲解Oracle数据库设置默认表空间问题

    实例讲解Oracle数据库设置默认表空间问题   实例讲解Oracle数据库设置默认表空间问题,阅读实例讲解Oracle数据库设置默认表空间问题,DBA们经常会遇到一个这样令人头疼的问题:不知道谁在O ...

  3. Filebeat 根据不同的日志设置不同的索引

    平时在物理机上使用 Filebeat 收集日志时,会编写多个 filebeat 配置文件然后启动多个 filebeat 进程来收集不同路径下的日志并设置相对应的索引.那么如果将所有的日志路径都写到一个 ...

  4. 试图删除 xx 和yy之间的关系。但是,关系的其中一个外键 (xx_yy.xxID) 无法设置为 null。

    错误原因:试图删除 UserInfoGroup 和 UserInfoGroupLinkLimitsOfAuthority 之间的关系.但是,关系的其中一个外键 (UserInfoGroupLinkLi ...

  5. ES 记录之如何创建一个索引映射,以及一些设置

    ElasticSearch 系列文章 1 ES 入门之一 安装ElasticSearcha 2 ES 记录之如何创建一个索引映射 3 ElasticSearch 学习记录之Text keyword 两 ...

  6. NPOI2.2.0.0实例详解(十)—设置EXCEL单元格【文本格式】 NPOI 单元格 格式设为文本 HSSFDataFormat

    NPOI2.2.0.0实例详解(十)—设置EXCEL单元格[文本格式] 2015年12月10日 09:55:17 阅读数:3150 using System; using System.Collect ...

  7. delphi开发实例:保存字体设置的方法

    http://blog.csdn.net/delphi308/article/details/9906147 delphi开发实例:保存字体设置的方法 2013-08-11 22:37 446人阅读  ...

  8. 【记录一个问题】android ndk下设置线程的亲缘性,总有两个核无法设置成功

    参考了这篇文章:https://blog.csdn.net/lanyzh0909/article/details/50404664 大体的代码如下: #include <pthread.h> ...

  9. Android 只开启一个Activity实例

    在一个Activity中,多次调用startActivity()来启动另一个Activity,要想只生成一个Activity实例,方法有两种. 方法一:设置起动模式 一个Activity有四种启动模式 ...

随机推荐

  1. Ubuntu下常用强化学习实验环境搭建(MuJoCo, OpenAI Gym, rllab, DeepMind Lab, TORCS, PySC2)

    http://lib.csdn.net/article/aimachinelearning/68113 原文地址:http://blog.csdn.net/jinzhuojun/article/det ...

  2. 自动化运维工具SaltStack安装配置

    SaltStack是一种全新的基础设置管理方式,部署轻松,在几分钟内可运作起来,扩展性好,很容易管理上万台服务器,速度够快,服务器之间秒级通讯.通过部署SaltStack环境,我们可以在成千上万台服务 ...

  3. 20189215《Linux内核原理与分析》第一周作业

    实验1 Linux系统简介 本节主要学习了 Linux 的历史,Linux 与 Windows 的区别等入门知识.通过学习,我明确了目的,是要用 Linux 来做程序开发.搭建服务器等:并且非常接受不 ...

  4. windows10下如何进行源码编译安装tensorflow

    1.获取python3.5.x https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe 2.安装python3.5.x,默认安装即 ...

  5. postman 安装桌面版

    https://github.com/postmanlabs/postman-app-support

  6. django 常用字段类型

    <> CharField #字符串字段, 用于较短的字符串. #CharField 要求必须有一个参数 maxlength, 用于从数据库层和Django校验层限制该字段所允许的最大字符数 ...

  7. c++ 字符串拷贝以及合并

    #include<iostream> #include<string> using namespace std; class stringfun { ]; public: vo ...

  8. 快递100API接口开发

    api.kuaidi100.com 获得物流单号的跟踪信息(免费) 1.应用场景 2.是否需要授权 3.请求地址 4.输入参数 5.返回结果 6.返回示例 7.API工具 8.FAQ 通过向指定的地址 ...

  9. Java回顾之I/O

    这篇文章主要回顾Java中和I/O操作相关的内容,I/O也是编程语言的一个基础特性,Java中的I/O分为两种类型,一种是顺序读取,一种是随机读取. 我们先来看顺序读取,有两种方式可以进行顺序读取,一 ...

  10. chrome插件访问原始页面的变量

    开发chrome插件时遇到需要获取原始网页中的一个js变量的值问题.由于content.js和原始网页的作用域环境不同,无法直接获取变量的值,提示undefined.谷歌找到大神提供的办法.综合起来记 ...