{"id":28670816,"url":"https://github.com/lifailon/logporter","last_synced_at":"2026-06-08T16:02:13.262Z","repository":{"id":298463039,"uuid":"999484164","full_name":"Lifailon/logporter","owner":"Lifailon","description":"A simple and lightweight alternative to cAdvisor for getting all basic metrics from Docker containers with support metrics by logs.","archived":false,"fork":false,"pushed_at":"2025-12-23T13:27:25.000Z","size":11015,"stargazers_count":31,"open_issues_count":1,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-25T03:11:26.990Z","etag":null,"topics":["cadvisor","container","docker","docker-container","exporter","golang","log","log-metrics","logging","logs","metrics","metrics-exporter","monitoring","prometheus","prometheus-exporter"],"latest_commit_sha":null,"homepage":"https://grafana.com/grafana/dashboards/23848-docker-exporter-logporter","language":"Go","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/Lifailon.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-10T10:17:04.000Z","updated_at":"2025-12-23T13:27:28.000Z","dependencies_parsed_at":"2025-06-11T08:42:15.927Z","dependency_job_id":"017240ef-b864-422e-a898-491e9f9aa8a8","html_url":"https://github.com/Lifailon/logporter","commit_stats":null,"previous_names":["lifailon/logporter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Lifailon/logporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Flogporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Flogporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Flogporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Flogporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lifailon","download_url":"https://codeload.github.com/Lifailon/logporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Flogporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34069501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cadvisor","container","docker","docker-container","exporter","golang","log","log-metrics","logging","logs","metrics","metrics-exporter","monitoring","prometheus","prometheus-exporter"],"created_at":"2025-06-13T18:10:15.637Z","updated_at":"2026-06-08T16:02:13.257Z","avatar_url":"https://github.com/Lifailon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logporter\n\nA simple and lightweight alternative to [cAdvisor](https://github.com/google/cadvisor) for getting all basic metrics from Docker containers with support metrics by logs.\n\nComparative measurement of CPU and memory usage from `cAdvisor` and `logporter` metrics in 3 hours:\n\n![](/img/cadvisor-cpu-usage.jpg)\n\n![](/img/logporter-cpu-usage.jpg)\n\n\u003e [!NOTE]\n\u003e On average, CPU consumption is 15-20 times lower and memory consumption is 10 times lower in the basic metrics mode (including IOps and uptime) compared to `cAdvisor`.\n\n## Why collect log counts?\n\n- Monitor the frequency and number of errors in logs using a custom query.\n- Compare the load increase with the number of logged messages. If the application does not consume many resources, the number of logged messages will reflect the load increase.\n- Speed ​​up log analysis by displaying at what point in time the most messages were received from the standard and error stream.\n\n\u003e [!WARNING]\n\u003e Receiving metrics data directly affects performance and CPU load may become higher than `cAdvisor`, this directly depends on the number of running containers, so it is recommended to use it with a small number of running containers or for one in log parsing mode.\n\n## Roadmap\n\n- [x] Functions for extracting basic metrics\n- [x] Functions for extracting custom metrics\n- [x] Converting metrics to Prometheus format\n- [x] HTTP server and logging\n- [x] Error handling (check for missing data)\n- [x] Getting data in a goroutine\n- [x] Grafana dashboard\n- [x] Docker image\n- [ ] Testing\n\n## Build\n\nBuild the Docker image yourself (optional):\n\n```bash\ngit clone https://github.com/Lifailon/logporter\ncd logporter\ndocker build -t lifailon/logporter .\n# or build for different architectures\ndocker buildx build --platform linux/amd64,linux/arm64 -t lifailon/logporter .\n```\n\n## Install\n\n- Run the exporter in a container using an image from [Docker Hub](https://hub.docker.com/r/lifailon/logporter):\n\n```bash\ndocker run -d --name logporter \\\n  -v /var/run/docker.sock:/var/run/docker.sock \\\n  -p 9333:9333 \\\n  --restart=unless-stopped \\\n  lifailon/logporter:latest\n```\n\nOr download the [docker-compose](https://github.com/Lifailon/logporter/blob/main/docker-compose.yml) file:\n\n```bash\nmkdir logporter \u0026\u0026 cd logporter\ncurl -sSL https://raw.githubusercontent.com/Lifailon/logporter/refs/heads/main/docker-compose.yml -o docker-compose.yml\ndocker-compose up -d\n```\n\nUse environment variables to configure the exporter:\n\n| Label                       | Type      | Default                        | Description                                                                                           |\n| --------------------------- | --------- | ------------------------------ | ----------------------------------------------------------------------------------------------------- |\n| `DOCKER_LOG_METRICS`        | `boolean` | `false`                        | Getting the number of messages in logs from all streams                                               |\n| `DOCKER_LOG_CUSTOM_METRICS` | `boolean` | `false`                        | Enable getting custom metrics                                                                         |\n| `DOCKER_LOG_CUSTOM_QUERY`   | `string`  | `\\\"(err\\|error\\|ERR\\|ERROR)\\\"` | Custom filter query in regex format (default example is equivalent to `error` level in `json` format) |\n| `DOCKER_HOST`               | `string`  | `\"\"`                           | Optional: Use a docker proxy instead of the docker socket mount for additional security.              |\n\n- Connect the new target in the `prometheus.yml` configuration:\n\n```yml\nscrape_configs:\n  - job_name: logporter\n    scrape_interval: 5s\n    scrape_timeout: 1s\n    static_configs:\n      - targets:\n        - localhost:9333\n```\n\n\u003e [!NOTE]\n\u003e If you are using custom metrics to get log counts, change the polling interval and response timeout settings in Prometheus based on the requests processing time in the exporter logs.\n\n- Import the prepared public [Grafana dashboard](https://grafana.com/grafana/dashboards/23848-docker-exporter-logporter) using the id `23848` or from [json](https://raw.githubusercontent.com/Lifailon/logporter/refs/heads/main/grafana/dashboard.json) file.\n\n![](/img/metrics-1.jpg)\n\n![](/img/metrics-2.jpg)\n\n- Set up alerts via [Alertmanager](https://github.com/prometheus/alertmanager), for example to receive notifications about high CPU load and reboot containers:\n\n```yml\ngroups:\n- name: processor\n  rules:\n  - alert: CONTAINER_CPU_WARN\n    expr: avg(rate(docker_cpu_usage_total[1m])) by (containerName) * 100 \u003e 50\n    for: 1m\n    labels:\n      severity: warning\n    annotations:\n      description: \"CPU load above 50% on container {{ $labels.containerName }}\"\n\n- name: reboot\n  rules:\n  - alert: CONTAINER_UPTIME_ERR\n    expr: avg(changes(docker_started_time[1m])) by (containerName,hostname) \u003e 0\n    labels:\n      severity: error\n    annotations:\n      description: \"Reboot container {{ $labels.containerName }} on {{ $labels.hostname }}\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifailon%2Flogporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifailon%2Flogporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifailon%2Flogporter/lists"}