码迷,mamicode.com
首页 > 其他好文 > 详细

Centos 7 配置 filebeat 6.4

时间:2018-09-21 11:36:21      阅读:836      评论:0      收藏:0      [点我收藏+]

标签:日志   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

Centos 7 配置 filebeat 6.4

标签:日志   host   redis服务器   xxxx   password   一个   syslog   centos 7   ges   

原文地址:http://blog.51cto.com/mydbs/2177985

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!