Search code examples
elasticsearchlogstashelastic-stacklogstash-configurationelasticsearch-x-pack

Encrypt / secure Elasticsearch's password in logstash.conf file


I'm using x-pack to secure ELK stack , I don't want to specify plain text "username" and "password" in logstash.conf for elasticsearch output plugin. Is there any way to do that?

output {
elasticsearch {
  hosts => "hostname"
  user => "username"
  password => "password"
  ssl => true
  ssl_certificate_verification => true
  truststore => "keystore.jks"
  truststore_password => changeme
  index => "logstash-%{+YYYY.MM.dd}"
  template => "log-template.json"
  template_name => "logstash*"
  template_overwrite => true
}
}

Solution

  • If anyone looking for answer of same question then elasticsearch x-pack supports PKI based authentication, you just need to enable PKI authentication on elasticsearch , using this link and then update elasticsearch's output in logstash.conf to use PKI authentication, using this link.You can do same for kibana also.