ELK + Filebeat 配置

ELK + Filebeat 配置

目标架构

环境要求:安装jdk
硬件要求:4G内存,cpu核数至少2
示例版本:7.10.2
示例系统:linux
其他说明:
官网下载相同版本的elk和filebeat,注意,版本需保持一致
下载的文件解压缩即可使用
不能使用root启动,需要创建用户,并分配elk目录权限

elasticsearch.yml配置:

 network.host: 0.0.0.0
 http.port: 9200
 http.cors.enabled: true
 http.cors.allow-origin: "*"
 node.name: node-1
 cluster.initial_master_nodes: ["node-1"]

启动命令:

./bin/elasticsearch &

kibana配置:

 server.port: 5601
 server.host: "0.0.0.0"
 elasticsearch.hosts: ["http://localhost:9200"]
 kibana.index: ".kibana"

启动命令:

./bin/kibana &

logstash配置:

input {
  beats {
    port => 5044
  }
}

output {
  if 'sgbGame' in [tags] {
    elasticsearch {
      hosts => ["http://localhost:9200"]
      index => "sgbgame-%{+YYYY.MM.dd}"
      #index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
      #user => "elastic"
      #password => "changeme"
    }
  }
  else if 'slotGame' in [tags] {
    elasticsearch {
      hosts => ["http://localhost:9200"]
      index => "slotgame-%{+YYYY.MM.dd}"
      #index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
      #user => "elastic"
      #password => "changeme"
    }
  }
}

启动命令:

./bin/logstash -f config/logstash.conf &

filebeat配置:

filebeat.inputs:
- type: log
  enabled: true
  paths: "/usr/local/slot/logs/GameService/*"
  tags: ["slotGame"]
- type: log
  enabled: true
  paths: "/usr/local/sgb/logs/GameService/*"
  tags: ["sgbGame"]
  
output.logstash:
  hosts: ["172.16.15.139:5044"]
  topic: '%{[fields.log_topic]}'

processors:
- add_host_metadata: ~
- add_cloud_metadata: ~

启动命令:

./filebeat -e -c filebeat.yml &
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值