使用Serilog创建elasticsearch geo_point

时间:2016-11-11 22:00:26

标签: c# elasticsearch kibana serilog

我正在使用Serilog将日志消息推送到elasticsearch,因此我可以在Kibana中可视化日志数据。

现在,我想将一些geo_points推向弹性。但是怎么样?它甚至可能吗?

我试过这个:

Log.ForContext<MyClass>().ForContext("GeoPoint",     
geoPoint.text).Information(geoPointJSON);

使用包含地理点作为对象的geoPointJSON,如下所示:

{
    "text":"Test location",
    "location":
    {
        "lat":"47,391624",
        "lon":"12,635912"
     }
}

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html

但是在Kibana我得到了这个:

{
  "_index": "logstash-2016.11.11",
  "_type": "logevent",
  "_id": "AVhVJug8Um5uh8sCEYD7",
  .
  .
  .
    "message": "{\"text\":\"Test location\",\"location\":  
        {\"lat\":\"47,234325\",\"lon\":\"11,880672\"}}",
        "fields": {
        "GeoPoint": "Test location",
        "SourceContext": "myClass"
    }
}

这似乎不对。

我可以使用serilog将地理点推送到elasticsearch,以便使用Kibanas Tile map可视化地理点吗?怎么样?

0 个答案:

没有答案