2017-07-20 13 views
0

私はCSVファイルを持っており、Logstashを使用してElasticsearch 5.0.0にインポートします。CSVファイルのコンテンツをElasticsearchにアップロードするためのLogstashコード

Id,CameraId,ZoneId,Latitude,Longitude,Number,OriginalNumber,Country,OriginalCountry,CapturedOn,Status,Direction,Speed,Confidence,AvgDigitsHeight,MultiplateRate,ProcessingTimeOCR,Signaled,OcrImageId,EnvImageIds,CapturerId,CapturerType,IsAlarm,AlarmListIds,ReplicationId,ImagesUploaded 
111,24,1,42.8,3.5,XXDFR,XXDFR,DE,DE,2017-03-04 12:06:20.0,0,1,0,99,21.0,3,16.0193003809306,0,0,[],null,null,0,[],0,0 

私はこのLogstashのスクリプトを実行します。:

input { 
    file { 
     path => ["/usr/develop/test.csv"] 
     type => "core2" 
     start_position => "beginning" 
    } 
} 

filter { 
    csv { 
     columns => [ 
"Id","CameraId","ZoneId","Latitude","Longitude,"Number","OriginalNumber","Country","OriginalCountry","CapturedOn","Status","Direction","Speed","Confidence","AvgDigitsHeight","MultiplateRate","ProcessingTimeOCR","Signaled","OcrImageId","EnvImageIds","CapturerId","CapturerType","IsAlarm","AlarmListIds","ReplicationId","ImagesUploaded" 
     ] 
    } 
} 

output { 
    stdout { codec => rubydebug } 
    elasticsearch { 
     action => "index" 
     hosts => ["127.0.0.1:9200"] 
     index => "mytest" 
     document_type => "doc" 
     document_id => "%{Id}" 
     workers => 1 
    } 
} 

を、私はこのエラーを取得する:あなたの場合

logstash.agent ] fetched an invalid config {:config=>"input {\nfile {\npath => [\"/usr/develop/test.csv\"]\ntype => \"core2\"\nstart_position => \"beginning\" \n}\n}\nfilter {\ncsv {\nseparator => \",\"\ncolumns => [\"Id\",\"CameraId\",\"ZoneId\",\"Latitude\",\"Longitude,\"Number\",\"OriginalNumber\",\"Country\",\"OriginalCountry\",\"CapturedOn\"]\n}\n}\noutput {\nelasticsearch {\naction => \"index\"\nhosts => [\"localhost:9200\"]\nindex => \"test\"\ndocument_type => \"doc\"\ndocument_id => \"%{Id}\"\nworkers => 1\n}\nstdout { codec => rubydebug}\n}\n\n", :reason=>"Expected one of #, {, ,, ] at line 11, column 61 (byte 225) after filter {\ncsv {\nseparator => \",\"\ncolumns => [\"Id\",\"CameraId\",\"ZoneId\",\"Latitude\",\"Longitude,\""}

+0

Longitudeの後ろに二重引用符がありません: '' Longitude、 '< - here – Val

答えて

1

わからない

これは、CSVファイルの最初の2行ですこれをまだ捕まえましたが、それはあなたが "列名のために"行方不明であるためです。経度 "

関連する問題