Docker Compose
Last updated
Was this helpful?
Last updated
Was this helpful?
This article explains how to collect logs and propagate them to EFK (Elasticsearch + Fluentd + Kibana) stack. The example uses for setting up multiple containers.
had been an open-source search engine known for its ease of use. had been an open-source Web UI that makes Elasticsearch user-friendly for marketers, engineers and data scientists alike.
NOTE: Since v7.11, These products are distributed under non open-source license (Dual licensed under Server Side Public License and Elastic License)
By combining these three tools EFK (Elasticsearch + Fluentd + Kibana) we get a scalable, flexible, easy to use log collection and analytics pipeline. In this article, we will set up four (4) containers, each includes:
All the logs of httpd
will be ingested into Elasticsearch + Kibana, via Fluentd.
Please download and install Docker / Docker Compose. Well, that's it :)
docker-compose.yml
With the YAML file below, you can create and start all the services (in this case, Apache, Fluentd, Elasticsearch, Kibana) by one command:
Let's start the containers:
Use docker ps
command to verify that the four (4) containers are up and running:
httpd
Access LogsUse curl
command to generate some access logs like this:
Then, go to Discover
tab to check the logs. As you can see, logs are properly collected into the Elasticsearch + Kibana, via Fluentd.
Create docker-compose.yml
for . Docker Compose is a tool for defining and running multi-container Docker applications.
The logging
section (check ) of web
container specifies as a default container logging driver. All the logs from the web
container will automatically be forwarded to host:port
specified by fluentd-address
.
Create fluentd/Dockerfile
with the following content using the Fluentd ; and then, install the Elasticsearch plugin:
Then, create the Fluentd configuration file fluentd/conf/fluent.conf
. The input plugin receives logs from the Docker logging driver and elasticsearch
output plugin forwards these logs to Elasticsearch.
NOTE: The detail of used parameters for @type elasticsearch
, see and furthermore.
Browse to and create data view.
Specify fluentd-*
to Index pattern
and click Save data view to Kibana
.
If this article is incorrect or outdated, or omits critical information, please . is an open-source project under . All components are available under the Apache 2 License.