温馨提示×

filebeat在ubuntu上的插件怎么安装

小樊
57
2025-08-20 05:05:25
栏目: 智能运维

在Ubuntu上安装Filebeat插件,通常可先安装Filebeat,再根据需求配置不同类型的插件,以下是具体步骤:

安装Filebeat

  1. 更新系统包:sudo apt update
  2. 添加Elastic官方GPG密钥和APT仓库(以Elastic 8.x为例):
    • sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
    • wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
    • echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
    • sudo apt update
  3. 安装Filebeat:sudo apt install -y filebeat

配置插件

以常见的Elasticsearch、Logstash和Kafka输出插件为例:

  • Elasticsearch输出插件:编辑/etc/filebeat/filebeat.yml,添加output.elasticsearch: hosts: ["localhost:9200"],还可根据需要添加indexusernamepassword等配置。
  • Logstash输出插件:在filebeat.yml中配置output.logstash: hosts: ["localhost:5044"],如需认证则添加相应信息。
  • Kafka输出插件:配置output.kafka: hosts: ["kafka:9092"],并设置topicrequired_ackscompression等参数。

启用插件

配置完成后,重启Filebeat服务使插件生效:sudo systemctl restart filebeat

0