# Apm-server not getting connected to kibana. Using v 7.17.1 for all

**URL:** https://discuss.elastic.co/t/apm-server-not-getting-connected-to-kibana-using-v-7-17-1-for-all/364888
**Category:** Elasticsearch
**Tags:** elastic-stack-monitoring, elastic-stack-security, docker
**Created:** [August 14, 2024, 7:26am UTC](https://discuss.elastic.co/t/apm-server-not-getting-connected-to-kibana-using-v-7-17-1-for-all/364888 "2024-08-14T07:26:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Amol\_Nagotkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amol_nagotkar/32/124188_2.png) [@Amol\_Nagotkar](https://discuss.elastic.co/u/Amol_Nagotkar)
#### Post date: [August 14, 2024, 7:26am UTC](https://discuss.elastic.co/t/apm-server-not-getting-connected-to-kibana-using-v-7-17-1-for-all/364888/1 "2024-08-14T07:26:18Z")

</div>

Hi all,

issue is cant see index here [http://127.0.0.1:9200/\_cat/indices](http://127.0.0.1:9200/_cat/indices)

------------docker-compose file---------------  
version: '3'

services:  
elasticsearch:  
container\_name: elasticsearch  
image: [docker.elastic.co/elasticsearch/elasticsearch:7.17.1](http://docker.elastic.co/elasticsearch/elasticsearch:7.17.1)  
ports:  
- "9200:9200"  
environment:  
- xpack.security.enabled=true  
- discovery.type=single-node  
- ES\_JAVA\_OPTS=-Xmx2g -Xms2g  
volumes:  
# - ./cert:/usr/share/elasticsearch/cert  
- ./elasticsearch.yml:/usr/share/elasticsearch/elasticsearch.yml

kibana:  
container\_name: kibana  
image: [docker.elastic.co/kibana/kibana:7.17.1](http://docker.elastic.co/kibana/kibana:7.17.1)  
ports:  
- "5601:5601"  
depends\_on:  
- elasticsearch  
# privileged: true  
volumes:  
# - ./cert:/usr/share/kibana/cert  
- ./kibana.yml:/usr/share/kibana/config/kibana.yml  
environment:  
- ELASTICSEARCH\_HOSTS=[http://elasticsearch:9200](http://elasticsearch:9200)  
- elasticsearch.username=kibana\_system  
- elasticsearch.password=password  
# - SERVER\_SSL\_ENABLED=true  
# - SERVER\_SSL\_CERTIFICATE=/usr/share/kibana/cert/elastic-certificates.crt  
# - SERVER\_SSL\_KEY=/usr/share/kibana/cert/elastic-certificates.key

filebeat:  
build:  
context: ./filebeat  
container\_name: filebeat  
command: filebeat -e -strict.perms=false  
volumes:  
# - ./cert:/usr/share/filebeat/cert  
- /path:/app/logs/template  
- /path:/app/logs/shortcode-generation  
depends\_on:  
- elasticsearch  
- kibana  
environment:  
- ELASTICSEARCH\_HOSTS=[http://elasticsearch:9200](http://elasticsearch:9200)  
apm-server:  
image: [docker.elastic.co/apm/apm-server:7.17.1](http://docker.elastic.co/apm/apm-server:7.17.1)  
container\_name: apm-server  
environment:  
- apm-server.host=0.0.0.0:8200  
- output.elasticsearch.hosts=["[http://elasticsearch:9200](http://elasticsearch:9200)"]  
- apm-server.instrumentation.enabled=true  
- apm-server.instrumentation.environment=local  
- apm-server.instrumentation.hosts=["[http://localhost:8200](http://localhost:8200)"]  
ports:  
- "8200:8200"  
depends\_on:  
- elasticsearch  
volumes:  
# # - ./cert:/usr/share/apm-server/cert  
- ./apm-server.yml:/usr/share/apm-server/apm-server.yml  
template:  
network\_mode: "host"  
build:  
context: .  
dockerfile: Dockerfile  
container\_name: template  
depends\_on:  
- elasticsearch  
env\_file:  
- .env  
volumes:  
- /etc/hosts:/etc/hosts  
- ./logs/template:/app/logs

volumes:  
elasticsearch\_data:  
driver: local

----------filebeat.yml -----------------  
name: "shortify-filebeat"  
logging.metrics.enabled: true  
xpack.security.enabled: true  
xpack.monitoring.enabled: true  
setup.ilm.enabled: true

filebeat.inputs:

- type: log  
scan\_frequency: 1s  
enabled: true  
paths:

- type: log  
scan\_frequency: 1s  
enabled: true  
paths:

output.elasticsearch:  
hosts: ["elasticsearch:9200"]  
index: "shortify"  
username: "elastic"  
password: "password"

setup.template:  
name: 'shortify'  
pattern: 'shortify-\*'  
enabled: true

--------------elasticsearch.yml--------------  
xpack.security.enabled: true

discovery.type: single-node

network.host: 127.0.0.1

http.port: 9200

-----------kibana.yml--------------------  
server.name: "kibana"

server.host: "0.0.0.0" # Bind to all network interfaces

elasticsearch.hosts: ["[http://127.0.0.1:9200](http://127.0.0.1:9200)"]

elasticsearch.username: "kibana\_system"

elasticsearch.password: "password"

xpack.security.encryptionKey: "a-z"

xpack.encryptedSavedObjects.encryptionKey: "a-z"

xpack.reporting.encryptionKey : "a-z"

xpack.security.session.idleTimeout: "1h"

xpack.security.session.lifespan: "30d"

elasticsearch.ssl.verificationMode: none

------------apm-server.yml---------------  
apm-server:  
host: "0.0.0.0:8200"

output.elasticsearch:  
hosts: ["[http://localhost:9200](http://localhost:9200)"]

username: "elastic"  
password: "password"

instrumentation:

enabled: true  
environment: "local"

hosts:

- [http://localhost:8200](http://localhost:8200)

----------------i have created roles and assigned it to user also------------  
curl --location '[http://localhost:9200/\_xpack/security/role/filebeat\_writer](http://localhost:9200/_xpack/security/role/filebeat_writer)'   
--header 'Content-Type: application/json'   
--header 'Authorization: Basic ZWxhc3RpYzp2aXZhQDEyMw=='   
--data '{  
"cluster": ["manage\_index\_templates", "monitor"],  
"indices": [  
{  
"names": ["filebeat-_","shortify-_"],  
"privileges": ["write","create\_index"]  
}  
]  
}'

curl --location '[http://localhost:9200/\_xpack/security/user/filebeat\_internal](http://localhost:9200/_xpack/security/user/filebeat_internal)'   
--header 'Content-Type: application/json'   
--header 'Authorization: Basic ZWxhc3RpYzp2aXZhQDEyMw=='   
--data-raw '{  
"password" : "password",  
"roles" : ["filebeat\_writer"],  
"full\_name" : "Internal Filebeat User"  
}'

i am able to create role and assign it to user.  
but not able to see indexes.

thanks in advance

---

<div class="post-metadata">

### Author: ![Musab\_Dogan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musab_dogan/32/70691_2.png) [@Musab\_Dogan](https://discuss.elastic.co/u/Musab_Dogan)
#### Post date: [August 14, 2024, 2:28pm UTC](https://discuss.elastic.co/t/apm-server-not-getting-connected-to-kibana-using-v-7-17-1-for-all/364888/2 "2024-08-14T14:28:42Z")

</div>

Let's diagnose the issue with the followings.

1. Update the filebeat.yml and use `elastic` user temporarily to see if it's an authentication issue.
2. Check filebeat logs to find some `ERROR` related to data flow.
3. Check the filebeat.paths to see if is there any data to send Elasticsearch. `/app/logs/shortcode-generation/*.log` and `/app/logs/template/*.log`

---

<div class="post-metadata">

### Author: ![Amol\_Nagotkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amol_nagotkar/32/124188_2.png) [@Amol\_Nagotkar](https://discuss.elastic.co/u/Amol_Nagotkar)
#### Post date: [August 16, 2024, 11:24am UTC](https://discuss.elastic.co/t/apm-server-not-getting-connected-to-kibana-using-v-7-17-1-for-all/364888/3 "2024-08-16T11:24:42Z")

</div>

I am able see index now.  
using v 7.17.1 for all  
Now i am getting error in apm-server. (apm-server not getting connected to kibana)

failed to obtain connection to Kibana: fail to get the Kibana version: HTTP GET request to [http://localhost:5601/api/status](http://localhost:5601/api/status) fails: fail to execute the HTTP GET request: Get "[http://localhost:5601/api/status\](http://localhost:5601/api/status%5C)": dial tcp [::1]:5601: connect: cannot assign requested address.

`{"log.level":"error","@timestamp":"2024-08-16T11:20:48.581Z","log.logger":"publisher_pipeline_output","log.origin":{"file.name":"pipeline/output.go","file.line":154},"message":"Failed to connect to backoff(elasticsearch(http://localhost:9200)): Get \"http://localhost:9200\": dial tcp [::1]:9200: connect: cannot assign requested address","service.name":"apm-server","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2024-08-16T11:20:48.581Z","log.logger":"publisher_pipeline_output","log.origin":{"file.name":"pipeline/output.go","file.line":145},"message":"Attempting to reconnect to backoff(elasticsearch(http://localhost:9200)) with 8 reconnect attempt(s)","service.name":"apm-server","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2024-08-16T11:20:48.581Z","log.logger":"publisher","log.origin":{"file.name":"pipeline/retry.go","file.line":219},"message":"retryer: send unwait signal to consumer","service.name":"apm-server","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2024-08-16T11:20:48.581Z","log.logger":"publisher","log.origin":{"file.name":"pipeline/retry.go","file.line":223},"message":" done","service.name":"apm-server","ecs.version":"1.6.0"} {"log.level":"error","@timestamp":"2024-08-16T11:20:48.582Z","log.logger":"esclientleg","log.origin":{"file.name":"transport/logging.go","file.line":37},"message":"Error dialing dial tcp 127.0.0.1:9200: connect: connection refused","service.name":"apm-server","network":"tcp","address":"localhost:9200","ecs.version":"1.6.0"}`

----------kibana.yml ------------  
server.name: "kibana"

server.host: "0.0.0.0" # Bind to all network interfaces  
elasticsearch.hosts: ["[http://127.0.0.1:9200](http://127.0.0.1:9200)"]

elasticsearch.username: "elastic"

elasticsearch.password: "password"

xpack.security.encryptionKey: "VtG9FgY8JQ8CZW4eZbL2rHw8u9wT1mXy"

xpack.encryptedSavedObjects.encryptionKey: "VtG9FgY8JQ8CZW4eZbL2rHw8u9wT1mXy"

xpack.reporting.encryptionKey : "VtG9FgY8JQ8CZW4eZbL2rHw8u9wT1mXy"

xpack.security.session.idleTimeout: "1h"

xpack.security.session.lifespan: "30d"

elasticsearch.ssl.verificationMode: none

-------------apm-server.yml-----------------  
apm-server:  
host: "localhost:8200"  
kibana:  
host: "[http://localhost:5601](http://localhost:5601)" # Replace with your Kibana URL  
username: "kibana\_system" # If authentication is required  
password: "password" # If authentication is required  
rum:  
enabled: true

output.elasticsearch:  
hosts: ["[http://localhost:9200](http://localhost:9200)"]  
username: "elastic"  
password: "password"

---------elasticsearch.yml----------  
xpack.security.enabled: true

discovery.type: single-node  
network.host: 127.0.0.1  
http.port: 9200

thank you in advance.
