2015-08-08 107 views
0

我有一個日誌字段在這個模式「24/09/2014」中的CSV文件中的日誌,但是當我用Logstash讀取文件時,日期字段有一個字符串類型。日期問題logstash

csv file example: 
fecha,cant,canb,id,zon 
24/09/2014,80,20,1.5,2 
01/12/2014,50,25,1,3 

我Logstash的conf文件:

input { 
    file { 
    path => "path/to/data.csv" 
    start_position => "beginning"  
    } 
} 
filter { 
    csv { 
     separator => "," 
     columns => ["fecha","cant","canb","id","zon"] 
    } 
date { 
match=> ["fecha","dd/MM/yyyy"] 
} 
    mutate {convert => ["cant", "integer"]} 
    mutate {convert => ["canb", "integer"]} 
    mutate {convert => ["id", "float"]} 
} 
output { 
    elasticsearch { 
     action => "index" 
     host => "localhost" 
     index => "barrena" 
     workers => 1 
    } 
    stdout {} 
} 

謝謝!

+0

@Val感謝您的編輯:) –

回答

0

日期將被複制到一個名爲@timestamp(日期過濾器)的字段中,並且該字段將是日期格式。 使用日期過濾器後,您可以安全地刪除fetcha字段。

+0

嗨@VinneMohan謝謝你的回覆。 –