{"id":23239309,"url":"https://github.com/julianhm9612/docker-elk-stack","last_synced_at":"2026-05-07T11:32:53.960Z","repository":{"id":120876410,"uuid":"543304003","full_name":"Julianhm9612/docker-elk-stack","owner":"Julianhm9612","description":"Example of an elastic stack configuration in docker :whale:","archived":false,"fork":false,"pushed_at":"2023-05-16T16:54:19.000Z","size":963,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T21:46:48.547Z","etag":null,"topics":["docker","docker-compose","elasticsearch","filebeat","kibana","logstash"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Julianhm9612.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-09-29T20:18:00.000Z","updated_at":"2023-05-15T21:28:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e1de3bf-46dc-4651-9fec-a66f31460b9f","html_url":"https://github.com/Julianhm9612/docker-elk-stack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Julianhm9612/docker-elk-stack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Julianhm9612%2Fdocker-elk-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Julianhm9612%2Fdocker-elk-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Julianhm9612%2Fdocker-elk-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Julianhm9612%2Fdocker-elk-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Julianhm9612","download_url":"https://codeload.github.com/Julianhm9612/docker-elk-stack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Julianhm9612%2Fdocker-elk-stack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32735148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["docker","docker-compose","elasticsearch","filebeat","kibana","logstash"],"created_at":"2024-12-19T04:27:52.954Z","updated_at":"2026-05-07T11:32:53.945Z","avatar_url":"https://github.com/Julianhm9612.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-elk-stack\n\n![Elastic stack](https://img.shields.io/badge/Elastic%20Stack-8.4.3-blue?style=for-the-badge\u0026logo=elasticsearch)\n![GitHub](https://img.shields.io/github/license/julianhm9612/docker-elk-stack?style=for-the-badge)\n![GitHub last commit](https://img.shields.io/github/last-commit/julianhm9612/docker-elk-stack?style=for-the-badge)\n\n## Introduction\nExample of an elastic stack configuration in docker :whale:\n\n## Work flow\n\u003e log -\u003e filebeat -\u003e logstash -\u003e elasticsearch \u003c- kibana\n\n## Main Features\n- Security enabled by default.\n- Example of reading data from log file.\n- Example of reading postgresql data.\n\n## Requirements\n- [Docker 20.05 or higher](https://docs.docker.com/install/)\n- [Docker-Compose 1.29 or higher](https://docs.docker.com/compose/install/)\n- 4GB RAM (For Windows and MacOS make sure Docker's VM has more than 4GB+ memory.)\n\n## Initial configuration\n\n### 1. Run elastic search container\n\u003e docker run -d --name elasticsearch elasticsearch:8.4.3\n\n### 2. Running an Interactive Shell in a elastic search Container\n\u003e docker exec -it elasticsearch sh\n\n### 3. Create a directory called certs and enter\n\u003e mkdir certs \u0026\u0026 cd certs\n\n### 4. Enable SSL\nCreate a self-signed certificate for Elasticsearch\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-certutil ca\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 --dns elasticsearch,logstash\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-certutil cert --pem -ca elastic-stack-ca.p12 --dns kibana\n\n\u003e openssl pkcs12 -in elastic-certificates.p12 -out logstash.pem -clcerts -nokeys\n\n\u003e openssl pkcs12 -in elastic-certificates.p12 -nocerts -nodes | sed -ne '/-BEGIN PRIVATE KEY-/,/-END PRIVATE KEY-/p' \u003e logstash-ca.key\n\n\u003e openssl pkcs12 -in elastic-certificates.p12 -cacerts -nokeys -chain | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \u003e logstash-ca.crt\n\n\u003e openssl pkcs12 -in elastic-certificates.p12 -clcerts -nokeys | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \u003e logstash.crt\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca-cert logstash-ca.crt --ca-key logstash-ca.key --dns logstash --pem\n\n\u003e openssl pkcs8 -in logstash-ca.key -topk8 -nocrypt -out logstash.pkcs8.key\n\n### 5. Get out of the container\n\u003e exit\n\n### 6. Extract elk certificates from docker\n\u003e docker cp elasticsearch:/usr/share/elasticsearch/certs ./certs\n\n### 7. Enable SSL and TLS\n\u003e /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.http.ssl.keystore.secure_password\n\n\u003e /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.http.ssl.truststore.secure_password\n\n### 8. Create passwords for basic users\nRun the next command to generate passwords for all the built-in users:\n\u003e bin/elasticsearch-setup-passwords auto\n\n## Customize Config\n- templates/custom-logs.template.json : Change it to your log index\n```\n# Make your own log index\n{\n    ...\n    \"mappings\": {\n        \"properties\": {\n            \"name\": {\n                \"type\": \"keyword\"\n            },\n            \"class\": {\n                \"type\": \"keyword\"\n            },\n            \"state\": {\n                \"type\": \"integer\"\n            },\n            \"@timestamp\": {\n                \"type\": \"date\"\n            }\n        }\n    }\n}\n```\n- logstash.conf\n```\n# Change 'timestamp' to your log custom timestamp key\nfilter {\n  ...\n  date{\n    match =\u003e [\"timestamp\", \"UNIX_MS\"]\n    target =\u003e \"@timestamp\"\n  }\n}\n```\n```\n# Change 'time.localtime' to your location time\nfilter {\n  ...\n  ruby {\n    code =\u003e \"event.set('indexDay', event.get('[@timestamp]').time.localtime('+09:00').strftime('%Y%m%d'))\"\n  }\n}\n```\n\n## Usage\nTo run the entire stack\n\u003e docker-compose up\n\nTo down the stack\n\u003e docker-compose down\n\n## if you have errors in chrome with the certificate you can run\n    sendCommand(SecurityInterstitialCommandId.CMD_PROCEED)\n\n## Urls and ports\n\n### Kibana\nhttps://localhost:5601/\n\n### Elasticsearch\nhttps://localhost:9200/\n\nhttps://localhost:9200/_cluster/health/?pretty\n\nhttps://localhost:9200/_xpack\n\nhttps://localhost:9200/_cat/indices?v\n\nhttps://localhost:9200/_aliases\n\n### Filebeat\nhttp://localhost:5066/?pretty\n\n# Task List\n\n- [] Automatic self-signed certificate generation\n- [] \n- [] \n\n# License\n\n[MIT License](https://raw.githubusercontent.com/julianhm9612/docker-elk-stack/master/LICENSE)\nCopyright (c) 2023 Julian Henao Marin\n\n# Contribution\n\nPR(s) are Open and Welcomed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianhm9612%2Fdocker-elk-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulianhm9612%2Fdocker-elk-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianhm9612%2Fdocker-elk-stack/lists"}