-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ea31fd
commit cc0b901
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM grafana/promtail:main | ||
|
||
COPY ./config.yml /etc/promtail/config.yaml | ||
|
||
ENTRYPOINT ["promtail", "--config.file=/etc/promtail/config.yaml", "--config.expand-env=true"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_PASSW="<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`) | | ||
| `LOKI_PUSH_USER` | User for Basic Auth | | ||
| `LOKI_PUSH_PASSW` | Password for Basic Auth | | ||
| `DOCKER_HOST` | Path to docker host (e.g. `unix:///var/run/docker.sock`) | | ||
| `INSTANCE_NAME` | Name of the instance | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
server: | ||
disable: true | ||
clients: | ||
- url: ${LOKI_PUSH_URL} | ||
basic_auth: | ||
username: ${LOKI_PUSH_USER} | ||
password: ${LOKI_PUSH_PASSW} | ||
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' | ||
- source_labels: ['__meta_docker_container_label_gather_logs'] | ||
regex: '.*' | ||
target_label: 'instance' | ||
replacement: ${INSTANCE_NAME} |