Centos 7 配置 filebeat 6.4
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos 7 配置 filebeat 6.4相关的知识,希望对你有一定的参考价值。
添加yum源
cat > /etc/yum.repos.d/artifacts.repo <<EOF
[elastic-6.x]
name=Elastic repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
安装filebeat
yum install filebeat
systemctl enable filebeat
配置filebeat
cat > /etc/filebeat/filebeat.yml <<EOF
################### Filebeat Configuration Example #########################
############################# Filebeat ######################################
filebeat:
prospectors:
- input_type: log
paths:
- /var/log/messages
document_type: syslog
fields:
type: syslog
ip: "192.168.1.2"
fields_under_root: true
- input_type: log
paths:
- /u01/redis/log/redis_*.log
- /u01/redis_cluster/log/node_*.log
- /u01/redis_cluster/run/node_*.conf
document_type: redis
fields:
type: redis
ip: "192.168.1.2"
fields_under_root: true
registry_file: /var/lib/filebeat/registry
output.redis:
hosts: "10.10.1.220"
port: 6379
#key: "redis"
key: "%{[type]}"
password: "xxxxxxxxxxxxx"
logging:
level: warning
to_files: true
files:
path: /var/log/mybeat
name: mybeat
rotateeverybytes: 10485760 # = 10MB
EOF
systemctl start filebeat
配置说明
filebeat:
prospectors:
- input_type: log
paths:
- /var/log/messages /*输入日志*/
document_type: syslog
fields:
type: syslog /*创建一个标签定义日志类型*/
ip: "192.168.1.2" /*创建一个标签定义IP*/
fields_under_root: true
- input_type: log
paths:
- /u01/redis/log/redis_*.log /*配置日志*/
- /u01/redis_cluster/log/node_*.log
- /u01/redis_cluster/run/node_*.conf
document_type: redis
fields:
type: redis
ip: "192.168.1.2"
fields_under_root: true
registry_file: /var/lib/filebeat/registry
output.redis:
hosts: "10.10.1.220" /*redis服务器地址*/
port: 6379 /*redis服务器端口*/
key: "%{[type]}" /*按自定义的类型写入相应的KEY*/
password: "xxxxxxxxxxxxx" /*redis服务器密码*/
logging:
level: warning
to_files: true
files:
path: /var/log/mybeat /*定义日志位置*/
name: mybeat
rotateeverybytes: 10485760 # = 10MB
以上是关于Centos 7 配置 filebeat 6.4的主要内容,如果未能解决你的问题,请参考以下文章