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

转载于:https://blog.51cto.com/mydbs/2177985

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值