下载oss版本的filebeatlogstash
如果版本不一样,替换链接中的版本号即可

配置logstash

input {
  beats {
    port => 5044
  }
}

output {
  opensearch {
    hosts => ["https://domain-endpoint:443"]
    index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
    user => "my-username"
    password => "my-password"
  }
}

配置filebeat

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /path/to/logs/dir/*.log
filebeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false
setup.ilm.enabled: false
setup.ilm.check_exists: false
setup.template.settings:
  index.number_of_shards: 1
output.logstash:
  hosts: ["logstash-host:5044"]

安装

bin/logstash-plugin install logstash-output-amazon_es
bin/logstash-plugin install logstash-output-opensearch

启动

./filebeat -e -c conf.yml
./bin/logstash -c config.conf