Closed nhluan closed 3 months ago
@nhluan all containers of the ELK stack are inside their own bridge network named "elk":
For them to be able to communicate with other containers, it is necessary to share a network. If your postgresql
container is running in a different network (e.g. the default Docker bridge network), the components of the ELK stack can't access it.
Using a user-defined network provides a scoped network in which only containers attached to that network are able to communicate. -- https://docs.docker.com/network/drivers/bridge/
You can connect your postgresql
container to the "elk" network and see if you are able to reach it.
For this, start by listing the available networks on your host:
docker network ls
Then list your containers to identify the postgresql
container:
docker container ls
Finally, attach the postgresql
container to the "elk" network:
docker network connect --alias my-database ELK_NETWORK PSQL_CONTAINER
After that, you should be able to change your Logstash configuration to use the following connection string: jdbc:postgresql://my-database:5552
.
Thank you, @antoineco for your response. By the way, I am encountering an issue when running my Docker compose with an ELK source using the new configuration I presented. (my structure based on your ELK source and make sure I don't change anything about position or something). And it's giving me an error indicating that it can't my configuration with logstash postgres. Any insight on this? (my error: [2024-04-05T06:31:40,600][ERROR][logstash.config.sourceloader] No configuration found in the configured sources.
).
Additional, except for the jdbc_connection_string
, Are all the parameters I have set up above correct, right?
Problem description
I cannot understand how to my postgres database which is running by container to connect with logstash and then, they can display on the kibana. So, when I set up my logstash.conf and run them. I have received the error =>
[2024-04-05T06:31:40,600][ERROR][logstash.config.sourceloader] No configuration found in the configured sources.
And my target is how to connect postgres database with logstash with this source.Extra information
I have not change anything file or structure what I have cloned from this repository.
Stack configuration
Docker setup
Container logs