2016-06-23 7 views
2

私はCSVにlatitudelongitudeのCSVファイルを持っていますが、Logstash 2.3.3でgeopointオブジェクトを作成しようとしています。木場4.5.1。 Kibanaでデータを可視化する際LogstashでCSV(緯度と経度の列)からジオポイントのオブジェクトを作成する

はしかし、私はlocation.latlocation.lon、種類floatないタイプgeopointlocationの両方を参照してください。

私は一般的にELKには新しく、これは私を狂っています。特に、私が探している情報のほとんどが古くなっているからです。

私はこのようなルックスを使用してい.confファイル:

input { 
    file { 
     path => "C:/file.csv" 
     start_position => "beginning"  
    } 
} 

filter { 
    csv { 
     separator => "," 
     columns => ["longitude","latitude"] 
    } 

    mutate { convert => {"latitude" => "float"} } 
    mutate { convert => {"longitude" => "float"} } 
    mutate { rename => {"latitude" => "[location][lat]"} } 
    mutate { rename => {"longitude" => "[location][lon]"} } 
    mutate { convert => { "[location]" => "float" } } 
} 

output { 
    elasticsearch { 
     template => "...\elasticsearch-template.json" 
     template_overwrite => true 
     action => "index" 
     hosts => "localhost" 
     index => "testindex1" 
     workers => 1 
    } 
    stdout {} 
} 

私は(elasticsearch-template.json)を指定していますテンプレートファイルは以下の通りです:

{ 
    "template" : "logstash-*", 
    "settings" : { 
    "index.refresh_interval" : "5s" 
    }, 
    "mappings" : { 
    "_default_" : { 
     "_all" : {"enabled" : true, "omit_norms" : true}, 
     "dynamic_templates" : [ { 
     "message_field" : { 
      "match" : "message", 
      "match_mapping_type" : "string", 
      "mapping" : { 
      "type" : "string", "index" : "analyzed", "omit_norms" : true, 
      "fielddata" : { "format" : "disabled" } 
      } 
     } 
     }, { 
     "string_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "string", 
      "mapping" : { 
      "type" : "string", "index" : "analyzed", "omit_norms" : true, 
      "fielddata" : { "format" : "disabled" }, 
      "fields" : { 
       "raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256} 
      } 
      } 
     } 
     } ], 
     "properties" : { 
     "@timestamp": { "type": "date" }, 
     "@version": { "type": "string", "index": "not_analyzed" }, 
     "geoip" : { 
      "dynamic": true, 
      "properties" : { 
      "ip": { "type": "ip" }, 
      "location" : { "type" : "geo_point" }, 
      "latitude" : { "type" : "float" }, 
      "longitude" : { "type" : "float" } 
      } 
     }, 
    "location" : { "type": "geo_point" } 
     } 
    } 
    } 
} 

誰も私を助けることができる場合、または私が間違っていることについていくつかの洞察を与えてください、私は非常に感謝します。また、これは私と同じボートにいるすべての人に役立つと確信しています。

私はそれを解決し、現在は完全に機能しています。テンプレートでタイプlogstash-*のインデックスを検索しましたが、testindex1を使用していました。インデックスをlogstash-%{+dd.MM.YYYY}に変更しました。

+1

に持ってマッピングを含むされていることを確認する必要があり、あなたがしている何の目的に反し、最後の 'mutate'を削除する必要があります達成しようとしている。また、 'testindex1'マッピングが' elasticsearch-template.json'ファイルにあるマッピングを忠実に含んでいることを確認できますか? – Val

+0

あなたの返事をありがとう、問題は確かに 'testindex1'マッピングでした。 – naranjja

+0

@val彼女はそれを受け入れるために回答として投稿するべきです。それは間違いなく問題です。 – pickypg

答えて

2

達成しようとしている目的を破る最後のmutateフィルタを削除する必要があります。

また、あなたがtestindex1マッピングが忠実にあなたが私の意見では、あなたのelasticsearch-template.jsonファイル