{"id":18822940,"url":"https://github.com/morzhanov/go-elk","last_synced_at":"2025-12-15T17:40:52.411Z","repository":{"id":122681092,"uuid":"416922206","full_name":"morzhanov/go-elk","owner":"morzhanov","description":"Go ELK stack (with Filebeat) example.","archived":false,"fork":false,"pushed_at":"2021-10-17T20:10:38.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T04:18:44.700Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/morzhanov.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}},"created_at":"2021-10-13T23:02:58.000Z","updated_at":"2022-06-13T04:43:10.000Z","dependencies_parsed_at":"2024-01-18T09:05:36.046Z","dependency_job_id":"1a580308-6d09-4cca-87b5-a442f2323f3c","html_url":"https://github.com/morzhanov/go-elk","commit_stats":null,"previous_names":["morzhanov/go-elk-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fgo-elk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fgo-elk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fgo-elk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fgo-elk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morzhanov","download_url":"https://codeload.github.com/morzhanov/go-elk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239758889,"owners_count":19692041,"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":[],"created_at":"2024-11-08T00:52:10.275Z","updated_at":"2025-12-15T17:40:52.358Z","avatar_url":"https://github.com/morzhanov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go ELK example\n\nGo ELK stack example with filebeat, metricbeat and ElasticSearch API.\n\n\u003cimg src=\"https://i.ibb.co/w6pFWFH/IMG-0148.png\" alt=\"arch\"/\u003e\n\n## Features\n\n- ELK stack setup\n- Filebeat logs collector setup\n- Metricbeat collector setup\n- ElasticSearch API usage\n\n## Structure\n\n- `/cmd` - application setup\n- `/config` - .env file with environment variables\n- `/deploy`\n  - `/filebeat` - filebeat.yml file for Filebeat setup \n  - `/metricbeat` - metricbeat.yml file for Metricbeat setup and Metricbeat Dockerfile\n  - `docker-compose.yml` - docker-compose file with ELK stack and beats\n- `/internal`\n  - `/config` - config module based on viper package\n  - `/doc` - ES Document interface\n  - `/es` - ElasticSearch module for ES API implementation usage\n  - `/generator` - generates Documents and sends them to ES using `es` module\n  - `/logger` - application logger, creates file transport (for filebeat) and console transport\n  - `/metrics` - setups application metrics handling via `expvar` package\n  - `/rest` - application REST module\n\n## How it works\n\n1. ES API\n   - application generate data with generator and saves them to ES\n   - application registers public REST API for ES data manipulation\n      - Update doc\n      - Delete doc\n      - Search docs\n2. Filebeat\n   - logger sends logs to `/logs` directory\n   - filebeat crawl the logs and sends them to ES\n3. Metricbeat\n   - metrics package registers application metric data\n     - go general metric data (memstat, cpu stats, etc.)\n     - request count\n     - error count\n     - docs count\n   - metricbeat consumes metrics from `localhost:8080/debug/vars` endpoint and sends them to the ES\n4. Kibana - uses for data visualization\n\n### Postman\n\nApplication contains `go-elk-example.postman_collection` file which you can import to your Postman app and perform requests to the application REST API.\n\n## Kibana setup\n\n### Create index patterns\n\nFirstly you should create index patterns for ES data:\n- `goelkmetr` - Go app metrics data\n- `goelklog` - Go app logs data\n- `docs` - ES Docs API data\n\nCreating Index patterns:\n\n\u003cimg src=\"https://i.ibb.co/QNp9PZz/1634497962209.png\" alt=\"kibana-setup\"/\u003e\n\nIndex patterns created:\n\n\u003cimg src=\"https://i.ibb.co/6HrCqDM/1634498016511.png\" alt=\"kibana-setup\"/\u003e\n\nDocs index example data:\n\n\u003cimg src=\"https://i.ibb.co/FDKp4yC/1634498033442.png\" alt=\"kibana-setup\"/\u003e\n\n### Discover\n\nAfter index patterns created we could search and filter data on the `Discover` page:\n\n\u003cimg src=\"https://i.ibb.co/SXKzVfK/1634498970258.png\" alt=\"kibana-setup\"/\u003e\n\nMetrics data on `Discover` page:\n\n\u003cimg src=\"https://i.ibb.co/B60nh52/1634498076514.png\" alt=\"kibana-setup\"/\u003e\n\n### Dashboard\n\nAlso, we could create a Kibana Dashboard and visualize ES data:\n- error count\n- request count\n- documents count\n- some go stats\n- some docs stats\n\n\u003cimg src=\"https://i.ibb.co/Yk8SBQg/1634498860795.png\" alt=\"kibana-setup\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorzhanov%2Fgo-elk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorzhanov%2Fgo-elk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorzhanov%2Fgo-elk/lists"}