在Ubuntu上安装Filebeat插件,通常可先安装Filebeat,再根据需求配置不同类型的插件,以下是具体步骤:
sudo apt update。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。sudo apt install -y filebeat。以常见的Elasticsearch、Logstash和Kafka输出插件为例:
/etc/filebeat/filebeat.yml,添加output.elasticsearch: hosts: ["localhost:9200"],还可根据需要添加index、username、password等配置。filebeat.yml中配置output.logstash: hosts: ["localhost:5044"],如需认证则添加相应信息。output.kafka: hosts: ["kafka:9092"],并设置topic、required_acks、compression等参数。配置完成后,重启Filebeat服务使插件生效:sudo systemctl restart filebeat。