Can't parse date in logstash

2019-09-12 12:15发布

I need to parse my Date and it gives me an error.

input {  
  file {
    path => "/home/osboxes/ELK/logstash/data/data.csv"
    start_position => "beginning"    
  }
}
filter {  
  csv {
      separator => ","
      columns => ["Date","Open","High","Low","Close","Volume","Adj Close"]
  }


  mutate {convert => ["High", "float"]}
  mutate {convert => ["Open", "float"]}
  mutate {convert => ["Low", "float"]}
  mutate {convert => ["Close", "float"]}
  mutate {convert => ["Volume", "float"]}
}

output {  
    elasticsearch {
        action => "index"
        hosts => "localhost:9200"
        index => "stock"
        workers => 1
    }
    stdout {}
}

The data.csv when I'm reading this is like this:

Date,Open,High,Low,Close,Volume,Adj Close
2015-04-02,125.03,125.56,124.19,125.32,32120700,125.32
2015-04-01,124.82,125.12,123.10,124.25,40359200,124.25

Where am I missing? Thanks in advance.

My logstash terminal only say this:

$ bin/logstash -f /home/osboxes/ELK/logstash/logstash.conf 
Settings: Default pipeline workers: 2
Pipeline main started

1条回答
甜甜的少女心
2楼-- · 2019-09-12 12:56

Add a date statement to the filter:

date {
    match => [ "Date", "YYYY-MM-dd" ]
}
查看更多
登录 后发表回答