Send logs to Elasticsearch®
You can store logs from one of your Aiven services in an external Elasticsearch service.
Collect these values for the connection:
| Variable | Description | 
|---|---|
ELASTICSEARCH_USER | User name to access the Elasticsearch service. | 
ELASTICSEARCH_PASSWORD | Password to access the Elasticsearch service. | 
ELASTICSEARCH_HOST | HTTPS service host of your external Elasticsearch service. | 
ELASTICSEARCH_PORT | Port to use for the connection. | 
CA_CERTIFICATE | CA certificate in PEM structure, if necessary. | 
CONNECTION_NAME | Name of this external connection to be used with Aiven services. | 
Create external Elasticsearch integration
Start by setting up an external service integration for Elasticsearch.
- Log in to the Aiven Console.
 - In the project, click Integration endpoints.
 - Select External Elasticsearch from the list.
 - Select Add new endpoint.
 - Set a preferred endpoint name, we'll call it 
CONNECTION_NAMElater. - In the connection URL field set the connection string in a format
https://ELASTICSEARCH_USER:ELASTICSEARCH_PASSWORD@ELASTICSEARCH_HOST:ELASTICSEARCH_PORT, using your own values for those parameters. - Set desired index prefix, that doesn't overlap with any of already existing indexes in your Elasticsearch service.
 - Optional: Add the body of your CA certificate in PEM format.
 - Click Create.
 
Send service logs to Elasticsearch
- Click Services and open a a service.
 - On the sidebar, click Integrations.
 - Select Elasticsearch Logs from the list.
 - Select the Endpoint name and click Enable.
 
note
Logs are split per day with index name consisting of your desired index
prefix and a date in a format year-month-day, for example
logs-2022-08-30.
note
You can also set up the integration using Aiven CLI and the following commands: