【发布时间】:2019-11-18 09:33:53
【问题描述】:
我在考虑搜索我记录的事件时遇到了障碍。我正在使用弹性搜索解决方案、filebeat 将消息从日志加载到弹性搜索,以及 Kibana 前端。
我目前将消息记录到字段message,并将异常堆栈跟踪(如果存在)记录到error.message。因此记录的事件的 sn-p 可能如下所示:
{
"message": "Thrown exception: CustomException (Exception for testing purposes)"
"error" : {
"message" : "com.press.controller.CustomException: Exception for testing purposes\n at
com.press.controller....<you get the idea at this point>"
}
}
当然还有其他字段,例如时间戳,但这些并不重要。重要的是:
当我搜索message : customException 时,我可以找到我记录的事件。当我搜索error.message : customException 时,我没有得到这些事件。我需要能够全文搜索所有字段。
有没有办法告诉 elasticsearch 在字段中启用全文搜索? 为什么“消息”字段默认启用它?我的同事都不知道部署后在控制台中的字段上运行了任何索引命令,并且我们的权限不允许我或其他团队成员在任何字段上运行索引或分析命令。所以它必须在某个地方的配置中。
到目前为止,我无法找到解决方案。请把我推向正确的方向。
编辑: 字段配置如下:
我们使用修改后的ECS,两条消息都声明为
level: core
type: text
在文件fields.yml 中。
在filebeat中,配置sn-p是这样的:
filebeat.inputs:
- type: log
enabled: true
paths: .....
...
...
processors:
- rename:
fields:
- from: "msg"
to: "message"
- from: "filepath"
to: "log.file.name"
- from: "ex"
to: "error.message"
ignore_missing: true
fail_on_error: true
logging.level: debug
logging.to_files: true
出于安全要求,我不能透露完整的文件。另外,我需要手写所有的 sn-ps,所以拼写错误可能是我的错。
谢谢
【问题讨论】:
-
请分享您的映射。
标签: elasticsearch full-text-search kibana