update promtail-examples.md

rewrite exist example, and add more examples with descriptions
pull/477/head
Sergey Leleko 7 years ago committed by GitHub
parent f15567297a
commit d63268bf48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      docs/promtail-examples.md

@ -1,7 +1,10 @@
# promtail examples
#### In this file you can see simple examples of configure promtail
For work with 2 and more sources:
* This example of config promtail based on original docker [config](https://github.com/grafana/loki/blob/master/cmd/promtail/promtail-docker-config.yaml)
and show how work with 2 and more sources:
Filename for example: my-docker-config.yaml
```
server:
http_listen_port: 9080
@ -35,12 +38,23 @@ scrape_configs:
__path__: /srv/log/someone_service/*.log
```
#### Description
##### Description
Scrape_config section of config.yaml contents are various jobs for parsing your logs on current host
`job` and `host` these are tags on which you can filter parsed logs date on Grafana later
`__path__` it is path to directory where stored your logs. (*)
`__path__` it is path to directory where stored your logs.
If you run promtail and this config.yaml in Docker container, don't forget use docker volumes for mapping real directories
with log to those folders in the container.
* - If you run promtail and this config.yaml in Docker container, you can use docker volumes for mapping real directories
with log to those folders in the container.
* See next example of Dockerfile, who use our modified promtail config (my-docker-config.yaml)
1) Create folder, for example `promtail`, then new folder build and in this filder conf and place there `my-docker-config.yaml`.
2) Create new Dockerfile in root folder `promtail`, with contents
```
FROM grafana/promtail:latest
COPY build/conf /etc/promtail
```
3) Create your Docker image based on original Promtail image and tag it, for example `mypromtail-image`
3) After that you can run Docker container by this command:
`docker run -d --name promtail --network loki_network -p 9080:9080 -v /var/log:/var/log -v /srv/log/someone_service:/srv/log/someone_service mypromtail-image -config.file=/etc/promtail/my-docker-config.yaml`

Loading…
Cancel
Save