如何删除filebeat标签,如id,hostname,version,grok_failure消息

时间:2018-04-09 12:40:31

标签: logstash kibana elastic-stack logstash-grok

我是elk的新手,我的示例日志看起来像

lastRow("Sheet1",2)

我的文件配置位于

之下
2017-01-05T14:28:00 INFO zeppelin IDExtractionService transactionId abcdef1234 operation extractOCRData received request duration 12344 exception error occured

我的logstash filter.conf文件:

filebeat.prospectors:
- input_type: log
  paths:
    - /opt/apache-tomcat-7.0.82/logs/*.log

document_type: apache-access
fields_under_root: true

output.logstash:
  hosts: ["10.2.3.4:5044"]

在kibana仪表板中,我可以看到日志输出如下

filter {
  grok {
    match => [ "message", "transactionId %{WORD:transaction_id} operation %{WORD:otype} received request duration %{NUMBER:duration} exception %{WORD:error}" ]
  }
}
filter {
    if "beats_input_codec_plain_applied" in [tags] {
        mutate {
            remove_tag => ["beats_input_codec_plain_applied"]
        }
    }
}

1第一个问题是如何删除filebeat标签,如id,hostname,version,grok_failure message

2如何基于时间戳对日志进行排序,因为新生成的日志没有出现在kibana仪表板上

3我的grok过滤器是否需要进行任何更改

1 个答案:

答案 0 :(得分:2)

您可以通过在filebeat配置文件中设置/api/users/confirmation?confirmation_token=XLDVqqMZwXg6dszyV_nc的值来删除filebeat标记。您可以阅读此选项here

  

如果此选项设置为true,则自定义字段将存储为   输出文档中的顶级字段,而不是在其下分组   字段子字典。如果自定义字段名称与其他字段冲突   Filebeat添加的字段名称,自定义字段覆盖另一个   字段。

您可以使用fields_under_root: false检查_grokparsefailure是否在标记中,并使用if "_grokparsefailure" in [tags]将其删除

你的grok过滤器似乎没问题。

希望它有所帮助。