Secrets in Elasticsearch
less than a minute
Store Elasticsearch credentials as secrets for Elasticsearch destination nodes.
Elasticsearch Destination
Secrets to create:
| Secret Name | Description |
|---|---|
es-username | Elasticsearch username |
es-password | Elasticsearch password |
Elasticsearch Destination Node:
- name: elasticsearch_destination
type: elasticsearch_output
endpoint: https://elasticsearch.example.com:9200
index: logs
username: '{{ SECRET es-username }}'
password: '{{ SECRET es-password }}'
Elasticsearch with API Key
If using API key authentication instead of basic auth, store the API key as a secret.
Secret to create:
| Secret Name | Description |
|---|---|
es-api-key | Elasticsearch API key |
Elasticsearch with API Key:
- name: elasticsearch_destination
type: elasticsearch_output
endpoint: https://elasticsearch.example.com:9200
index: logs
api_key: '{{ SECRET es-api-key }}'
Multiple Elasticsearch Clusters
If you send data to multiple Elasticsearch clusters, create separate secrets for each.
Secrets to create:
| Secret Name | Description |
|---|---|
es-prod-username | Production Elasticsearch username |
es-prod-password | Production Elasticsearch password |
es-staging-username | Staging Elasticsearch username |
es-staging-password | Staging Elasticsearch password |
Multiple Elasticsearch Destinations:
- name: elasticsearch_prod
type: elasticsearch_output
endpoint: https://es-prod.example.com:9200
index: prod-logs
username: '{{ SECRET es-prod-username }}'
password: '{{ SECRET es-prod-password }}'
- name: elasticsearch_staging
type: elasticsearch_output
endpoint: https://es-staging.example.com:9200
index: staging-logs
username: '{{ SECRET es-staging-username }}'
password: '{{ SECRET es-staging-password }}'
See Also
- Elastic Destination Node - Complete Elasticsearch destination configuration reference
- Secrets Overview - Secrets management concepts