elasticsearch - Filebeat 多行过滤器不起作用?

标签 elasticsearch logstash elastic-stack filebeat

我正在尝试从 filebeat 读取文件并将它们推送到 logstash。在推送它们之前,我正在尝试合并包含 java 堆栈跟踪的事件。我试过这个过滤器,但它不起作用。

filebeat.prospectors:
- type: log
  paths:
- /mnt/logs/myapp/*.log

multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after

这是我试图推送到logstash的日志示例。我想将堆栈跟踪事件合并到带有时间戳的事件之前
2019-02-18 17:08:44 augmentos  http-nio-8090-exec-4 INFO c.a.s.c.a.a.CommonCorpAuthAspect@validateAuth:68 - Header Name: connection And Header Value : keep-alive
2019-02-18 17:08:44 augmentos  http-nio-8090-exec-4 INFO c.a.s.c.a.a.CommonCorpAuthAspect@validateAuth:118 - Permission status is true
2019-02-18 17:08:44 augmentos  http-nio-8090-exec-4 INFO c.a.s.c.a.c.AssetADVActionResource@emailAssets:92 - User testqa is sending Asset on Email.
2019-02-18 17:08:47 augmentos  http-nio-8090-exec-4 INFO c.a.spectra.aws.utils.S3ServiceUtil@generateSignedUrl:48 - Generating pre-signed URL with timeout 604800000
2019-02-18 17:08:56 augmentos  http-nio-8090-exec-4 ERROR c.a.s.c.a.a.CommonCorpAuthAspect@validateAuth:131 - Authorization Aspect error
java.lang.NullPointerException: null
        at com.ad2pro.spectra.core.acs.service.EmailHandlerService.getAssetFiles(EmailHandlerService.java:140)
        at com.ad2pro.spectra.core.acs.service.EmailHandlerService.emailAsset(EmailHandlerService.java:63)
        at com.ad2pro.spectra.core.acs.controllers.Test.emailAssets(AssetADVActionResource.java:104)
        at com.ad2pro.spectra.core.acs.controllers.Test$$FastClassBySpringCGLIB$$bfc0b3c1.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
2019-02-18 17:08:44 augmentos  http-nio-8090-exec-4 INFO c.a.s.c.a.a.CommonCorpAuthAspect@validateAuth:68 - Header Name: connection And Header Value : keep-alive
2019-02-18 17:08:44 augmentos  http-nio-8090-exec-4 INFO c.a.s.c.a.a.CommonCorpAuthAspect@validateAuth:118 - Permission status is true

合并事件后,如果我是对的,我想消息属性应该将两个事件消息连接起来,请对此提供帮助。

最佳答案

  • 你的正则表达式应该是好的。见 https://www.elastic.co/guide/en/beats/filebeat/7.5/_test_your_regexp_pattern_for_multiline.html你怎么能实际测试这个。
  • 这可能只是复制粘贴错误,但您的 YAML 文件的缩进看起来不正确。还要检查您的 Filebeat 日志是否有错误。这应该是:
     - type: log
       paths:
         - /mnt/logs/*.log
       multiline:
         pattern: '^\['
         negate: true
         match: after
    
  • 关于elasticsearch - Filebeat 多行过滤器不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54752650/

    相关文章:

    elasticsearch - kafka.common.KafkaException : Failed to parse the broker info from zookeeper from EC2 to elastic search

    powershell - 无法识别 Get-Content 命令

    elasticsearch - 如何在Elastic Search的过滤器聚合中引用多个嵌套级别?

    logstash - 如何让Logstash消费自己的日志

    amazon-web-services - Logstash 输出到 AWS EC2 上的 Elasticsearch

    elasticsearch - 将日志条目与 logstash 相结合

    elasticsearch - Elasticsearch部分查询

    elasticsearch - 如何在 spring boot 应用程序中显示 elasticsearch 查询

    arrays - 检索仅包含事件用户 ID 的对象

    java - 多个输入的 Hadoop MapReduce