gpt4 book ai didi

Filebeat TCP 输入使用情况

转载 作者:行者123 更新时间:2023-12-02 00:08:52 30 4
gpt4 key购买 nike

问题:

  • TCP 输入是否管理收割机(即,您是否将文件路径发送到 TCP 输入,然后收割机开始摄取该文件)?
  • TCP 输入能否接受结构化数据(例如 log 输入上的 json 配置选项)?
  • TCP 输入是否期望通过 TCP 连接发送的数据采用特定格式?

来自 filebeat 文档 (https://www.elastic.co/guide/en/beats/filebeat/current/how-filebeat-works.html#input):

What is an input? An input is responsible for managing the harvesters and finding all sources to read from.

文档对于如何使用 TCP 输入以及这些 TCP 输入期望的数据格式非常不清楚 ( https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-tcp.html )。我最终阅读了 TCP 输入的源代码,但我仍然不清楚如何使用 TCP 输入。

最佳答案

TL;DR:它需要一个 JSON 消息,我看到的是从 Logstash 发送到 filebeat。

我和你有同样的疑问。然而,我花了一整天的时间尝试以某种方式使用 filebeat。我想要实现的目标是在 kibana 中添加 stacktrace,很多网站都说,作为一个好的实践,你不应该在 Logstash 中应用多行 conecpt,而在 filebeat 中使用它。

因此,我尝试将 filebeat 添加到我的 ELK 堆栈中。

这是我的应用程序和堆栈之间的先前通信:

SpringApp > Logstash > ElasticSearch > Kibana

但我改变了它,添加了带有 TCP 通信的 filebeat

SpringApp > Logstash > Filebeat > ElasticSearch > Kibana

我通过以下配置实现了它:

logstash.conf

input {
tcp {
port => 5000
codec => multiline {
pattern => "\tat\s"
what => "previous"
}
}
}

## Add your filters / logstash plugins configuration here

output {
tcp {
host => "filebeat"
port => "5044"
mode => "client"
reconnect_interval => "2"
codec => "line"
}
stdout { }
}

文件beat.yml

filebeat.inputs:

- type: tcp
host: "0.0.0.0:5044"

multiline.pattern: '^\t'
multiline.negate: false
multiline.match: after

output.elasticsearch:
hosts: ["http://elasticsearch:9200"]

logging.level: debug
logging.to_files: true
logging.files:
path: /var/log/filebeat
name: filebeat
keepfiles: 7
permissions: 0644
logging.metrics.enabled: false

注1:Logstash通过TCP接收和发送通信
注2:filebeat 无法识别输出的其他logstash 编解码器
注3:我使用 kubernetes 和容器进行所有之间的通信

关于Filebeat TCP 输入使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56300381/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com