安装

yum -y install https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.6.0-x86_64.rpm

配置

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /data/logs/server.ser
  tags: ["online_server"]
- type: log
  enabled: true
  paths:
    - /data/logs/pay.ser
  tags: ["online_pay"]
- type: log
  enabled: true
  paths:
    - /data/logs/log.*
  tags: ["online_admin"]

output.elasticsearch:
  hosts: ["10.0.0.1:9200"]
  indices:
    - index: "online_server-%{+yyyy.MM.dd}"
      when.contains:
        tags: "online_server"
    - index: "online_pay-%{+yyyy.MM.dd}"
      when.contains:
        tags: "online_pay"
    - index: "online_admin-%{+yyyy.MM.dd}"
      when.contains:
        tags: "online_admin"

查看ES是否有索引

curl -XGET "http://10.0.0.1:9200/_cat/indices?v"