【问题标题】:Filebeat - kakfka output 'and' or 'regex' condition not workingFilebeat - kafka 输出“和”或“正则表达式”条件不起作用
【发布时间】:2020-11-27 12:09:30
【问题描述】:

kafka topic filter filebeat

您好,我正在尝试从不同的日志路径中过滤所有包含指示符“TEST01”的消息,并根据 fields.type 将消息发送到两个不同的主题(主题 1 和主题 2)

如果 fields.type 是“first_test”,那么消息应该转到“topic1”,否则转到“topic2”。下面是我尝试过的代码 - 但 and: 运算符不起作用。感谢有关在 filebeat -dynamic kafka 输出中编码复合条件的任何帮助。谢谢https://www.elastic.co/guide/en/beats/filebeat/master/defining-processors.html#condition-equals

topics:
  - topic: "topic1"
    and:
      - when.contains:
           message: "TEST01"
      - equals:
          fields.type: "first_test"
  - topic: "topic2"
    and:
      - when.contains:
           message: "TEST01"
      - not:
          equals:
            fields.type: "first_test"

【问题讨论】:

    标签: filebeat elk


    【解决方案1】:

    在没有 and: 操作符的情况下完成了这项工作,但在下面的代码中使用了 'contains' 和不同的 fields.type。在我的问题的上下文中,关于如何使用和: ,正则表达式的任何答案都会有所帮助。谢谢

    topics:
      - topic: "topic1"
          - when.contains:
               message: "TEST01"
               fields.type: "first_test"
      - topic: "topic2"
          - when.contains:
               message: "TEST01"
               fields.type: "second_test
    

    【讨论】:

      猜你喜欢
      • 2021-05-27
      • 1970-01-01
      • 2018-09-15
      • 2019-06-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多