A simple alternative to cAdvisor for getting basic Docker container and custom metrics.
50K+
A simple and lightweight alternative to cAdvisor for getting all basic metrics from Docker containers with support metrics by logs.
Note
On average, CPU consumption is 20 times lower and memory consumption is 10 times lower in the basic metrics mode (including IOps and uptime) compared to `cAdvisor`.
Warning
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.
docker run -d --name logporter \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 9333:9333 \
--restart=unless-stopped \
lifailon/logporter:latest
Or download the docker-compose file:
mkdir logporter && cd logporter
curl -sSL https://raw.githubusercontent.com/Lifailon/logporter/refs/heads/main/docker-compose.yml -o docker-compose.yml
docker-compose up -d
Use environment variables to apply custom metrics:
| Lable | Type | Default | Description |
|---|---|---|---|
DOCKER_LOG_METRICS | boolean | false | Getting the number of messages in logs from all streams |
DOCKER_LOG_CUSTOM_METRICS | boolean | false | Enable getting custom metrics |
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) |
prometheus.yml configuration:scrape_configs:
- job_name: logporter
scrape_interval: 5s
scrape_timeout: 1s
static_configs:
- targets:
- localhost:9333
Note
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.
23848 or from json file.Content type
Image
Digest
sha256:c776dabc1…
Size
9.3 MB
Last updated
11 months ago
docker pull lifailon/logporter