centos &ubuntu 安装filebeat

先贴一下官方文档

https://www.elastic.co/guide/en/beats/filebeat/6.6/filebeat-installation.html

我本次使用rpm的方式安装,与官方文档略有差异,记录如下:

 centos安装

//官方是使用curl命令:curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.6.1-x86_64.rpm
//但是我所用的服务器可能做了限制(报curl: (35) SSL connect error),我使用wget代替,下载到服务器上,如下
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.6.1-x86_64.rpm
sudo rpm -vi filebeat-6.6.1-x86_64.rpm

ubuntu安装

wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.2.0-amd64.deb
sudo dpkg -i filebeat-7.2.0-amd64.deb

配置input

  安装成功之后,配置文件的路经在/etc/filebeat/filebeat.yml,直接使用vimfilebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.

- type: log
 # 默认为false,需要把enabled改为true
  # Change to true to enable this input configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
  # 日志文件所在目录
- /var/log/*.log
#- D:datalogs*

配置output.elasticsearch

output.elasticsearch:
  # Array of hosts to connect to.
 # 输出至目的elasticsearch hosts: [
"localhost:9200"]

重启filebeat

 service filebeat restart
原文地址:https://www.cnblogs.com/lixyu/p/10489758.html