1

我正在尝试将 Serilogger 与 Elasticsearch 一起使用,但我不知道如何让它们一起工作。

[2015-06-02 12:45:49,149][DEBUG][action.bulk              ] [Jimaine Szardos] [logstash-2015.06.02][4] failed to execute bulk item (index) index {[logstash-2015.06.02][logevent][AU2z4ILA3Y9Gz86fGG3z], source[{"@timestamp":"2015-06-02T12:45:43.4368603+02:00","level":"Information","messageTemplate":"Creating new Taxi {0}","message":"Creating new Taxi \"84/10749/18/27/80\"","fields":{"0":"84/10749/18/27/80","SourceContext":"Akka.Logger.Serilog.SerilogLogger"}}]}
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [fields.0]
        at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:409)
        at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:706)
        at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:497)
        at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:554)
        at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:487)
        at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:544)
        at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
        at org.elasticsearch.index.shard.IndexShard.prepareCreate(IndexShard.java:453)
        at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:432)
        at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:149)
        at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:515)
        at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:422)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NumberFormatException: For input string: "84/10749/18/27/80"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Long.parseLong(Unknown Source)
        at java.lang.Long.parseLong(Unknown Source)
        at org.elasticsearch.common.xcontent.support.AbstractXContentParser.longValue(AbstractXContentParser.java:145)
        at org.elasticsearch.index.mapper.core.LongFieldMapper.innerParseCreateField(LongFieldMapper.java:300)
        at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:236)
        at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:399)
        ... 14 more

这似乎是logentry的内容

[{
  "@timestamp":"2015-06-02T12:45:43.4368603+02:00", 
  "level":"Information",
  "messageTemplate":"Creating new Taxi {0}", 
  "message":"Creating new Taxi \"84/10749/18/27/80\"",
  "fields": {
       "0":"84/10749/18/27/80",
       "SourceContext":"Akka.Logger.Serilog.SerilogLogger"
  }
}]

问题的原因是 Serilog 发布了格式错误的日志,还是这里发生了其他事情?

4

0 回答 0