GrayLog 不显示批量插入的消息

GrayLog not displaying messages that are Bulk inserted

我需要将数百万条记录从 SQL 数据库迁移到 ES。目前我们通过 GELF HTTP 在 ES 中插入记录,但一次只插入一条记录是不可行的。

我已经研究了几天,对 GrayLog 和 ElasticSearch 都是新手。我试图找到一种方法将消息批量插入 ES,然后让它们显示在 GrayLog 中。我一直在使用 Cerebro 来监控索引和每个索引中的消息数量。当我进行批量插入时,正确索引中的消息计数确实增加了,但是我在 GrayLog 中看不到它们。

这是我的:

var _elasticsearchContext = new ElasticsearchContext(ConnectionString, new ElasticsearchMappingResolver());
var connectionSettings = new ConnectionSettings(new Uri(ConnectionString))
.MapDefaultTypeIndices(m => m.Add(typeof(Auditing_Dev), "auditing-dev_0"));
var elasticClient = new ElasticClient(connectionSettings);

var items = new List<Auditing_Dev>();

//I loop through a DataReader creating new Auditing_Dev objects 
//and add them to the items collection

var bulkResponse = elasticClient.Bulk(b => b.IndexMany(items, (d, doc) => d.Document(doc).Index("auditing-dev_0").Type("message")));

我得到了一个有效的回复,我在 auditing-dev_0 索引中看到 Cerebro 中的文档计数增加了。当我将通过批量插入的消息与通过 HTTP 请求插入的消息进行比较时,索引和类型相同。

我插入的消息:

{
  "_index" : "auditing-dev_0",
  "_type" : "message",
  "_id" : "AVsWWn-jNp2NX1vOria1",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "level" : 5,
    "origin" : "10.80.3.2",
    "success" : true,
    "type" : "Company.Enterprise",
    "user" : "stupid@dropdown.test",
    "gl2_source_input" : "57193c1d0cf25a44afc31c15",
    "gl2_source_node" : "5866cc80-382e-4287-ae5b-8a0a68a9a1f1",
    "gl2_remote_ip" : "10.100.20.164",
    "gl2_remote_port" : 52273,
    "streams" : [ "578fbabe738a897c6d91336b" ]
  }
}

与通过 HTTP 插入的相比:

{
  "_index" : "auditing-dev_0",
  "_type" : "message",
  "_id" : "e3d34d50-0a8a-11e7-84bb-00155d007a32",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "level" : 5,
    "gl2_remote_ip" : "192.168.211.114",
    "origin" : "192.168.211.35",
    "gl2_remote_port" : 2960,
    "streams" : [ "578fbabe738a897c6d91336b" ],
    "gl2_source_input" : "57193c1d0cf25a44afc31c15",
    "success" : "True",
    "gl2_source_node" : "5866cc80-382e-4287-ae5b-8a0a68a9a1f1",
    "user" : "admin@purple-pink.test",
    "timestamp" : "2017-03-16 22:43:44.000"
  }
}

我看到 _id 的格式不同,但这有关系吗?

在 GrayLog 中只有一个 Input,那就是 GELF HTTP。我需要添加新的输入吗?

原来是时间戳字段不存在。谁知道?