【问题标题】:Logstash not working with allow_time_override and getting data loss influxdbLogstash 无法与 allow_time_override 一起使用并导致数据丢失 influxdb
【发布时间】:2018-05-30 20:10:15
【问题描述】:

我在使用带有 influxdb 输出插件的 logstash 5.2 版时遇到数据丢失问题。

我的 logstash 配置是:

filter {
  grok {
 patterns_dir => ["/etc/logstash/patterns"]
      match => { "message" => "%{NGINXACCESSBLOG}"}
      if [type] == "nginx-access-router" {
    ruby { code => "event.set('epoc', event.get('@timestamp').to_i)" }
    date {
        match => [ "timestamp" , "dd/MMM/YYYY:HH:mm:ss Z" ]
    target => "newdate"
      }

    mutate { convert => [ "request_time", "float" ] }
    if ![response] {
      mutate { add_field => ["response", "nil"] }
    }
}
}
}


output {

  if [type] == "nginx-access" {

        influxdb {
      host => "localhost"
      port => 8086
      user => "admin"
      password => "XXX"
      db => "xx"
      allow_time_override => true
      retention_policy => "XX"
      measurement => "XXXX"
      enable_metric => false
      send_as_tags => ["response"]
      data_points => {

        "response" => "%{[response]}"

    "timestamp" => "%{[epoc]}"
        "time" => "%{[epoc]}"


     }
     coerce_values => {
        "request_time"   => "float"
    }
}
}
}

注意:我在调试日志中检查了所有接收到的日志行都已成功解析为 grok 模式。

那为什么会有超过 50% 的数据丢失。

我尝试了一些解决方案: 按照 https://github.com/logstash-plugins/logstash-output-influxdb/issues/69

我尝试按照上述配置使用“allow_time_override”,但logstash 停止推送数据流入并且在错误日志文件中什么也没有。

【问题讨论】:

    标签: logstash influxdb data-loss


    【解决方案1】:

    经过一步一步的大量跟踪,能够找到我昨天发布的数据丢失问题的根本原因并修复。

    问题根本原因是:

    Influxdb 覆盖重复的时间戳

    解决方案:将时间覆盖为微秒

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-22
      • 1970-01-01
      • 2021-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-27
      • 2023-03-03
      相关资源
      最近更新 更多