在Ubuntu上安裝Filebeat插件,通??上劝惭bFilebeat,再根據需求配置不同類型的插件,以下是具體步驟:
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
。