【问题标题】:ELK stack data mapping featuresELK 堆栈数据映射功能
【发布时间】:2018-09-24 01:43:24
【问题描述】:

所以现在我想知道 ELK 堆栈中是否有一个功能可以对来自不同来源的数据进行查找和映射。

例如: 我有日志

'computer.log' -> {computer_id: 123456, internet_connected: 345612}
'phone.log' ->    {phone_id: 234561}
'internet.log' -> {internet_id: 345612, phone_push: 234561}

所以我们有 3 个日志流被发送到 filebeat -> logstash -> elasticsearch -> kibana

当我们需要跟踪哪部手机连接到计算机时,我想搜索“computer_id:123456”,然后弹出所有这3个日志。我知道我们可以在弹性搜索中搜索数据的特定索引,并在 logstash 中解析原始日志。但我想知道如果我们分别收到这 3 个日志(在 5 毫秒内),我该如何跟踪或进行映射。

logstash 会有这种数据跟踪功能,还是我必须编写一个程序来处理映射并将转换 id 插入到特定日志中,然后再流式传输到 logstash?

我不知道这个功能的确切名称,请告诉我 ELK 堆栈中是否有一个?

【问题讨论】:

    标签: elasticsearch mapping logstash trace


    【解决方案1】:

    如果 internet.log 以至少几秒钟的间隔保证最后出现,我们可以丰富包含 internet.log 的索引。

    我建议关注

    1. 在索引 internet.log 时,添加 document_id 作为 uuid - https://www.elastic.co/guide/en/logstash/current/plugins-filters-uuid.html 并添加一个状态 - '未处理'
    2. 添加另一个logstash
      • 输入 - 使用 elasticsearch 输入插件查询状态为未处理的 internet.log
      • 过滤器 1 - 使用 elasticsearch 过滤器插件查询 computer.log 以获取事件中的 computer_id 和其他字段(如果有)。
      • 过滤器 2 - 使用 elasticsearch 过滤器插件查询 phone.log 以获取事件中与手机相关的字段。
      • 如果过滤器 1 和 2 成功返回数据,则将状态更新为已处理。
      • 输出 - 使用相同的 document_id (uuid) 重新索引 internet.log 文档

    您可以在这里找到一些示例 - * https://www.elastic.co/guide/en/logstash/current/lookup-enrichment.html * https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html

    现在,您可以在单个索引 (index.log) 中搜索和查询所有数据。

    【讨论】:

      猜你喜欢
      • 2018-09-13
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 2022-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多