Multiple hosts output

Hi,
i have a local ES and also elastic cloud ES, the local ES dont have uid and pwd where as the elastic cloud ES has , how can i specify this in logstash output
output {
if [type] == "output" {
elasticsearch {
hosts => ["127.0.0.1:9200","EScloudurl"]
index => "metrics-%{+YYYY.MM.dd}"
}
}
}

how can i specify the username and password here.

If you want to send to two different clusters you will need to use two separate output blocks.

1 Like

can u give me some examples please

Something like this would allow to to manage settings for each output:

output {
  if [type] == "output" {
    elasticsearch {
      hosts => ["127.0.0.1:9200"]
      index => "metrics-%{+YYYY.MM.dd}"
    }

    elasticsearch {
      hosts => ["EScloudurl"]
      index => "metrics-%{+YYYY.MM.dd}"
    }
  }
}
1 Like

elastic cloud has https es url how can i use it here?

what we have to do to connect to https ES elastic cloud with authentication

Use the full https URL in hosts and specify user and password parameters as described in the documentation.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.