从 fluentd 在 elasticsearch 中添加原始字段

Add raw fields in elasticsearch from fluentd

我已经设置了一个集中式日志系统,我的应用程序节点安装了 FluentD,拖尾日志文件。应用程序节点上的 FluetndD 将处理后的日志转发到收集器节点上的 FluentD。该收集器节点上的 FluentD 然后转发到各种输出,其中一个是 ElasticSearch 集群。我然后运行 Kibana 从ES 读取。 (我认为这是相当常见的设置。)

当尝试在 Kibana 中的某些数据字段上可视化某些数据时,Kibana 没有正确分组。例如,电子邮件地址被视为多个值(名称、域等)。在做了一些研究之后,我的理解是问题在于我的字段也需要配置为复制为 .raw 值。 (分析与未分析)

问题是我不知道如何让 FluentD 将此数据添加到 Elasticsearch 中以包含 .raw 字段。据说这是 Logstash 默认执行的操作?

我正在使用 fluent-plugin-elasticsearch:https://github.com/uken/fluent-plugin-elasticsearch

要阻止 Elasticsearch 标记您的字段,您可以将字段指定为 not_analyzed by updating the index mapping. 您需要删除索引(或创建一个新索引)以查看此更改生效,因为您无法修改现有索引中的现有映射。您需要放置一个包含以下内容的映射:

{
  "email": {
    "type":     "string",
    "index":    "not_analyzed"
  }
}