filebeat客户端日志收集工具,以前就玩过,请参考:ubuntu elasticsearch,logstash,kibana,filebeat安装配置,以前用的filebeat应当是filebeat6,升级后,配置变化还是挺大的。
不建议filebeat用docker,直接安装挺方便,也不需要数据沉淀。也不想所有机器都装docker
1,配置es yum源
# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch # cat /etc/yum.repos.d/elastic.repo [elastic-7.x] name=Elastic repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
2,安装配置filebeat
# yum install filebeat # cat /etc/filebeat/filebeat.yml filebeat.inputs: - type: log enabled: true paths: - /home/www/ziwei/toutiao_php/storage/logs/*.log tags: ["194-ziwei-php"] - type: log enabled: true paths: - /var/log/nginx/*error.log tags: ["194-nginx-error"] filebeat.config.modules: path: ${path.config}/modules.d/*.yml reload.enabled: false setup.template.settings: index.number_of_shards: 1 setup.kibana: output.logstash: hosts: ["10.0.40.222:30044"] #output.elasticsearch: #hosts: ["10.0.40.222:9200"] processors: - add_host_metadata: ~ - add_cloud_metadata: ~ - add_docker_metadata: ~ - add_kubernetes_metadata: ~ # systemctl start filebeat
filebeat7是可以直接把数据储入到es的,当然也可以推送到logstash后,通过logstash存储到es。
特别说一下配置中的tag,可以打一个或多个标签,区别日志的来源。如下图
转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/server/2417.html