{"id":19168558,"url":"https://github.com/xanthous-tech/elastic-stack-docker-compose","last_synced_at":"2025-05-07T14:41:53.972Z","repository":{"id":105880390,"uuid":"98419142","full_name":"xanthous-tech/elastic-stack-docker-compose","owner":"xanthous-tech","description":"Sample docker-compose setup for spinning up Elastic Stack on a single machine on Docker","archived":false,"fork":false,"pushed_at":"2019-11-20T06:58:27.000Z","size":26384,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T23:32:00.476Z","etag":null,"topics":["belk","docker","docker-compose","elasticsearch","filebeat","kibana","logstash"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xanthous-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-26T12:15:03.000Z","updated_at":"2023-12-05T11:44:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"9efa739e-4758-4392-939c-6a7bd8bc8840","html_url":"https://github.com/xanthous-tech/elastic-stack-docker-compose","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanthous-tech%2Felastic-stack-docker-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanthous-tech%2Felastic-stack-docker-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanthous-tech%2Felastic-stack-docker-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanthous-tech%2Felastic-stack-docker-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xanthous-tech","download_url":"https://codeload.github.com/xanthous-tech/elastic-stack-docker-compose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252897433,"owners_count":21821436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["belk","docker","docker-compose","elasticsearch","filebeat","kibana","logstash"],"created_at":"2024-11-09T09:43:06.050Z","updated_at":"2025-05-07T14:41:53.947Z","avatar_url":"https://github.com/xanthous-tech.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# BELK Stack Setup\n## Beats (Filebeat)\n[Filebeat](https://www.elastic.co/guide/en/beats/filebeat/current/index.html) is a lightweight log shipper built for the Elastic Stack. It is written in Golang, and it doesn’t take up much resources on the host machine while shipping logs to Logstash, and has back-pressure sensing in case Logstash is overloaded.\n\nYou can find the sample Filebeat configuration here, and the main sections for the configuration in Filebeat is `input_type`s in `prospectors`, and `output` section. For the sample BELK setup, we are going to set `output` to Logstash from Filebeat. There are some basic filtering options built-in for Filebeat, such as multiline support and extra metadata, so we can mutate the logs somewhat before shipping to Logstash. When there are more logs to gather from more machines (\u003e5G per day), we would want to have message queue setup in the stack and the first stop for the logs would be in a message queue like Apache Kafka. You can find more about configuring Filebeat [here](https://www.elastic.co/guide/en/beats/filebeat/current/configuring-howto-filebeat.html).\n\nThere are also other beats available, and I think [Metricbeat](https://www.elastic.co/guide/en/beats/metricbeat/5.5/index.html) would also be a good one to deploy to production.\n\n## Logstash\nLogstash is the de facto log shipper for Elasticsearch. It has powerful filtering options for parsing logs into meaningful key-value pairs before putting into Elasticsearch for indexing. It is written in Ruby and running in JRuby.\n\nThe are two types of configurations for Logstash, one is the Logstash Settings, which controls the execution of Logstash. You can find it [here](https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html).\n\nThe configuration for Logstash has 3 major sections: `input`, `filter`s, and `output`. You can find the sample config here, and more about the configuration [here](https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html).\n\n## Elasticsearch\nElasticsearch is a data store and search engine that does most of the heavy lifting throughout the stack. It is written in Java and uses Apache Lucene under the hood for search indexing. It provides REST interface for ingesting and interacting with the data.\n\nThe configuration for Elasticsearch is quite complex, but the default settings can serve most of the needs if the data size is not too large. When the scale gets bigger, I will provide more info and reference as we go. For now I will just give a sample configuration and reference manual [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html).\n\n### Important Note for Configuring Elasticsearch in Production\n\nThere is a gotcha where in production systems, `vm.max_map_count` needs to set to 262144 in order to be able to start Elasticsearch Instance, since by default it is doing a memory bootstrap check, and requires to increase the limits for mmap counts. See more [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html) and [here (under `Running ES from the command line -\u003e Production mode` section)](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html)\n\n## Kibana\nKibana is a log viewer web interface written in node.js. It provides UI to query Elasticsearch and gives powerful charting and dashboarding features for users to view the logs in different ways. \n\nTo get it up and running, we only need to provide the address for Elasticsearch, and there will be step-by-step guide in the web UI to help us setup the viewing of the logs.\n\nThe search queries are mostly based on the search query APIs from Elasticsearch, putting some reference [here]().\n\n## Docker Deployment\nIf there is already Docker setup, the docker-compose file I am providing should spin up BELK all in one machine, with configurable options via bind-mounting configs and environment variables. They are going to be connected inside Docker’s network, but I will point out the network address configurations in case we want to switch to bare metal deployment, and cluster deployment.\n\nWhen you run `docker-compose up -d`, it will pull the official images from Elastic and load up the configurations into the container. Wait for about 3-5 minutes for everything to kick in, then you can visit Kibana at `localhost:5601`, and put in username `elastic`, password `changeme` to login, and at the startup page when it is prompted to configure an index pattern, use `filebeat-*` instead of `logstash-*`, and once you hit create, you can go back to the discover tab and see the logs show up on Kibana. Default logs are in date range July 26, 2017 to July 28, 2017.\n\nThe data directory is managed via [named volumes](https://docs.docker.com/engine/admin/volumes/volumes/). When `docker-compose up` is called, it will create the corresponding volumes in Docker and you can find them using `docker volume ls` and `docker volume inspect \u003cvolume_name\u003e` to see the mountpoint on the host machine. Normally when we tear down the containers using `docker-compose down`, the volumes will be retained, only when we use `docker-compose down -v`, that's when the volumes will also be torn down. More about this [here](https://docs.docker.com/compose/reference/down/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxanthous-tech%2Felastic-stack-docker-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxanthous-tech%2Felastic-stack-docker-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxanthous-tech%2Felastic-stack-docker-compose/lists"}