filebeatは複数のファイルを監視し、異なるindexのelasticsearchに書き込む

685 ワード

filebeat.prospectors:
- input_type: log
  paths:
    - /home/user/website/log/aaaa.log
  json.keys_under_root: true
  json.overwrite_keys: true
  fields:
    index: 'aaaa_history'

- input_type: log
  paths:
    - /home/user/website/log/bbbb_history.log
  json.keys_under_root: true
  json.overwrite_keys: true
  fields:
    index: 'bbbb_history'

output.elasticsearch:
  hosts: ["172.16.0.40:9200"]
  indices:
    - index: "bbbb_history"
      when.contains:
        fields:
          index: "bbbb_history"
    - index: "aaaa_history"
      when.contains:
        fields:
          index: "aaaa_history"