APM Integration index templates never created in docker/local environment
- Dominant language
- Gherkin
- Stars
- 427
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Apologies if this is the wrong repository for reporting this issue. I am happy to recreate it elsewhere is necessary.
When running Elasticsearch, Kibana and APM-Server locally, I cannot enable the APM integration, as the `logs-apm.*` and `traces-apm.*` index templates are never created.
**To Reproduce**
Run Elasticsearch and Kibana locally with docker:
```
docker network create elastic
docker run --name es01 --net elastic -p 9200:9200 -it docker.elastic.co/elasticsearch/elasticsearch:8.5.2
docker run --name kib-01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.5.2
```
Do the auth dance for kibana, and visit http://0.0.0.0:5601/app/home#/tutorial/apm to install the APM integration.
Pick the "macOS" option (I suppose the windows option may show the same issue as well.
Follow the instructions to run apm-server locally, and start it (this isn't very obvious from the setup page either, especially due to the lack of proper SSL certificated in a docker setup, but that's another issue).
apm-server then shows the following errors (excerpt, but they're all the same, with all the index templates used by apm-server):
```
{"log.level":"error","@timestamp":"2022-12-08T10:04:15.425+0100","log.logger":"beater","log.origin":{"file.name":"beater/waitready.go","file.line":62},"message":"precondition 'apm integration installed' failed: error querying Elasticsearch for integration index templates: unexpected HTTP status: 404 Not Found ({\"error\":{\"root_cause\":[{\"type\":\"resource_not_found_exception\",\"reason\":\"index template matching [traces-apm.sampled] not found\"}],\"type\":\"resource_not_found_exception\",\"reason\":\"index template matching [traces-apm.sampled] not found\"},\"status\":404}): to remediate, please install the apm integration: https://ela.st/apm-integration-quickstart","service.name":"apm-server","ecs.version":"1.6.0"}
{"log.level":"error","@timestamp":"2022-12-08T10:04:25.425+0100","log.logger":"beater","log.origin":{"file.name":"beater/waitready.go","file.line":62},"message":"precondition 'apm integration installed' failed: error querying Elasticsearch for integration index templates: unexpected HTTP status: 404 Not Found ({\"error\":{\"root_cause\":[{\"type\":\"resource_not_found_exception\",\"reason\":\"index template matching [logs-apm.error] not found\"}],\"type\":\"resource_not_found_exception\",\"reason\":\"index template matching [logs-apm.error] not found\"},\"status\":404}): to remediate, please install the apm integration: https://ela.st/apm-integration-quickstart","service.name":"apm-server","ecs.version":"1.6.0"}
```
Checking for "APM Server Status" also checks for the presence of those index templates, so it doesn't detect it as running.

If I click on "Launch APM" anyway, there are more errors, still because the index templates don't exist.

**Expected behavior**
The documented way to run apm-server in a local/development environment for testing purposes should allow setting up the instrumentation.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.