标签:日志 host redis服务器 xxxx password 一个 syslog centos 7 ges
添加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
标签:日志 host redis服务器 xxxx password 一个 syslog centos 7 ges
原文地址:http://blog.51cto.com/mydbs/2177985