【问题标题】:Logstash filter parse date formatLogstash 过滤器解析日期格式
【发布时间】:2016-01-01 19:53:41
【问题描述】:

我正在尝试解析 csv 并将其输出到弹性文件,我遇到了日期格式问题

Date,In1,In2,In3,In4,In5,In6 
31/12/2015,1527.96,1527.95,1528.74,1534.43,1525.76,716485827
30/12/2015,1534.59,1532.26,1527.96,1534.55,1526.47,716485827
29/12/2015,1524.67,1532.47,1534.59,1535.73,1530.90,717176468
28/12/2015,1533.85,1533.09,1524.67,1533.16,1523.20,710573918

logstash.config

# test file
input {
   file {
      path => "/config/file.csv"
      type => "core2"
      start_position => "beginning"
   }
}

filter {
 csv {
     separator => ","
    }
}

output {
    elasticsearch {
        action => "index"
        hosts => ["elastic:9200"]
        index => "ta25"
        workers => 1
    }

}

如何将Date 列解析为logstash 过滤器?

【问题讨论】:

  • 列是否被拆分为 7 个新字段?

标签: logstash


【解决方案1】:

使用过滤日期https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date

filter {
  date {
    match => [ "Date", "dd/mm/YYYY" ]
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-20
    • 1970-01-01
    • 2016-05-21
    • 1970-01-01
    • 2014-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多