Skip to content

Commit

Permalink
Merge branch 'master' into metrics-pusher
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-oleynik committed Aug 8, 2024
2 parents 1d68129 + 597db08 commit 6458431
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- wklink
- om-bistro
- metrics-pusher
- promtail
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 2 additions & 0 deletions nginx-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ FROM nginxproxy/nginx-proxy
RUN { \
echo 'proxy_read_timeout 3600s;'; \
echo 'client_max_body_size 0;'; \
echo 'gzip on;'; \
echo 'gzip_types application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component application/octet-stream application/x-protobuf;'; \
} > /etc/nginx/conf.d/overwrites.conf
5 changes: 5 additions & 0 deletions promtail/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM grafana/promtail:3.0.0

COPY ./config.yml /etc/promtail/config.yaml

ENTRYPOINT ["promtail", "--config.file=/etc/promtail/config.yaml", "--config.expand-env=true"]
29 changes: 29 additions & 0 deletions promtail/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Promtail

## Usage

Run using docker:

```sh
docker run -v /var/run/docker.sock:/var/run/docker.sock \
-e LOKI_PUSH_URL="<domain>/loki/api/v1/push" \
-e LOKI_PUSH_USER="<user>" \
-e LOKI_PUSH_PASSWORD="<password>" \
-e DOCKER_HOST="/var/run/docker.sock" \
-e INSTANCE_NAME="HelloWorld" \
scalableminds/promtail
```

This will scrape all containers with label `gather.logs=true`.

## Configuration

Environment Variables:

| Name | Description |
|------|-------------|
| `LOKI_PUSH_URL` | URL to push to (e.g. `<domain>/loki/api/v1/push`) |
| `AUTH_USER` | User for Basic Auth |
| `AUTH_PASSWORD` | Password for Basic Auth |
| `DOCKER_HOST` | Path to docker host (e.g. `unix:///var/run/docker.sock`) |
| `INSTANCE_NAME` | Name of the instance |
20 changes: 20 additions & 0 deletions promtail/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server:
disable: true
clients:
- url: ${LOKI_PUSH_URL}
basic_auth:
username: ${AUTH_USER}
password: ${AUTH_PASSWORD}
external_labels:
instance: ${INSTANCE_NAME}
scrape_configs:
- job_name: docker
docker_sd_configs:
- host: ${DOCKER_HOST}
relabel_configs:
- source_labels: ['__meta_docker_container_name']
regex: '/(.*)'
target_label: 'container'
- source_labels: ['__meta_docker_container_label_gather_logs']
regex: 'true'
action: 'keep'

0 comments on commit 6458431

Please sign in to comment.