2016-08-05 202 views
0

我需要解析我的日期,它給了我一個錯誤。無法解析日誌logstash

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 {} 
} 

,當我讀這本data.csv是這樣的:

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 

我在哪裏丟失的?提前致謝。

我logstash終端只說:

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

什麼錯誤?沒有看到任何錯誤。 – mustaccio

+0

編輯該問題。 – Elsendion

回答

0

添加日期聲明過濾器:

date { 
    match => [ "Date", "YYYY-MM-dd" ] 
} 
+0

什麼都沒有發生。它只是說「設置:默認管道工:2 管道主開始」就是這樣。 – Elsendion

+0

'YYYY'應該是'yyyy'。您還需要將新數據添加到CSV文件中,或者在文件輸入中設置'sincedb_path =>「/ dev/null」' – Val

+0

是否發生過這種情況。 「從字段{:field =>」Date「,:value =>」Date「,:exception =>」Invalid format:\「Date \」「,:config_parsers =>」yyyy-MM-dd「, :config_locale =>「default = en_GB」,:level =>:warn}「我正在以詳細模式運行它。 – Elsendion