|
|
@ -15,13 +15,15 @@
|
|
|
|
- name: Loki
|
|
|
|
- name: Loki
|
|
|
|
type: loki
|
|
|
|
type: loki
|
|
|
|
access: proxy
|
|
|
|
access: proxy
|
|
|
|
url: http://host.docker.internal:3100
|
|
|
|
url: http://loki:3100
|
|
|
|
mode: "0644"
|
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create Loki config dirs
|
|
|
|
- name: Create Loki config dirs
|
|
|
|
ansible.builtin.file:
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /mnt/lotus-land-story/loki/{{ item }}
|
|
|
|
path: /mnt/lotus-land-story/loki/{{ item }}
|
|
|
|
state: directory
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
owner: 10001
|
|
|
|
|
|
|
|
group: 10001
|
|
|
|
mode: "0755"
|
|
|
|
mode: "0755"
|
|
|
|
loop:
|
|
|
|
loop:
|
|
|
|
- config
|
|
|
|
- config
|
|
|
@ -29,13 +31,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: Configure Loki
|
|
|
|
- name: Configure Loki
|
|
|
|
ansible.builtin.copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
dest: /mnt/lotus-land-story/loki/config/config.yml
|
|
|
|
dest: /mnt/lotus-land-story/loki/config/loki.yml
|
|
|
|
content: |
|
|
|
|
content: |
|
|
|
|
auth_enabled: false
|
|
|
|
auth_enabled: false
|
|
|
|
|
|
|
|
|
|
|
|
server:
|
|
|
|
server:
|
|
|
|
http_listen_port: 3100
|
|
|
|
http_listen_port: 3100
|
|
|
|
|
|
|
|
|
|
|
|
common:
|
|
|
|
common:
|
|
|
|
path_prefix: /loki
|
|
|
|
path_prefix: /loki
|
|
|
|
storage:
|
|
|
|
storage:
|
|
|
@ -46,7 +46,6 @@
|
|
|
|
ring:
|
|
|
|
ring:
|
|
|
|
kvstore:
|
|
|
|
kvstore:
|
|
|
|
store: inmemory
|
|
|
|
store: inmemory
|
|
|
|
|
|
|
|
|
|
|
|
schema_config:
|
|
|
|
schema_config:
|
|
|
|
configs:
|
|
|
|
configs:
|
|
|
|
- from: 2020-10-24
|
|
|
|
- from: 2020-10-24
|
|
|
@ -56,32 +55,78 @@
|
|
|
|
index:
|
|
|
|
index:
|
|
|
|
prefix: index_
|
|
|
|
prefix: index_
|
|
|
|
period: 24h
|
|
|
|
period: 24h
|
|
|
|
|
|
|
|
|
|
|
|
storage_config:
|
|
|
|
storage_config:
|
|
|
|
filesystem:
|
|
|
|
filesystem:
|
|
|
|
directory: /data
|
|
|
|
directory: /data
|
|
|
|
|
|
|
|
|
|
|
|
ruler:
|
|
|
|
ruler:
|
|
|
|
alertmanager_url: http://localhost:9093
|
|
|
|
alertmanager_url: http://localhost:9093
|
|
|
|
|
|
|
|
owner: 10001
|
|
|
|
|
|
|
|
group: 10001
|
|
|
|
|
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# https://github.com/grafana/loki/issues/2361
|
|
|
|
|
|
|
|
- name: Configure Promtail
|
|
|
|
|
|
|
|
ansible.builtin.copy:
|
|
|
|
|
|
|
|
dest: /mnt/lotus-land-story/loki/config/promtail.yml
|
|
|
|
|
|
|
|
content: |
|
|
|
|
|
|
|
|
server:
|
|
|
|
|
|
|
|
http_listen_port: 9080
|
|
|
|
|
|
|
|
grpc_listen_port: 0
|
|
|
|
|
|
|
|
positions:
|
|
|
|
|
|
|
|
filename: /tmp/positions.yaml
|
|
|
|
|
|
|
|
clients:
|
|
|
|
|
|
|
|
- url: http://loki:3100/loki/api/v1/push
|
|
|
|
|
|
|
|
scrape_configs:
|
|
|
|
|
|
|
|
- job_name: system
|
|
|
|
|
|
|
|
static_configs:
|
|
|
|
|
|
|
|
- targets:
|
|
|
|
|
|
|
|
- localhost
|
|
|
|
|
|
|
|
labels:
|
|
|
|
|
|
|
|
job: varlogs
|
|
|
|
|
|
|
|
__path__: /var/log/*log
|
|
|
|
|
|
|
|
- job_name: docker
|
|
|
|
|
|
|
|
docker_sd_configs:
|
|
|
|
|
|
|
|
- host: unix:///var/run/docker.sock
|
|
|
|
|
|
|
|
refresh_interval: 5s
|
|
|
|
|
|
|
|
relabel_configs:
|
|
|
|
|
|
|
|
- source_labels: ['__meta_docker_container_name']
|
|
|
|
|
|
|
|
regex: '/(.*)'
|
|
|
|
|
|
|
|
target_label: 'container'
|
|
|
|
mode: "0644"
|
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Run Loki
|
|
|
|
- name: Run Loki
|
|
|
|
community.docker.docker_compose:
|
|
|
|
community.docker.docker_container:
|
|
|
|
project_name: loki
|
|
|
|
# recreate: true
|
|
|
|
remove_orphans: true
|
|
|
|
# restart: true
|
|
|
|
definition:
|
|
|
|
name: loki
|
|
|
|
version: "3.3"
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
|
|
|
loki:
|
|
|
|
|
|
|
|
image: grafana/loki:2.8.0
|
|
|
|
image: grafana/loki:2.8.0
|
|
|
|
ports:
|
|
|
|
ports:
|
|
|
|
- "3100:3100"
|
|
|
|
- "3100:3100"
|
|
|
|
command: -config.file=/mnt/config/config.yml
|
|
|
|
command: -config.file=/mnt/config/loki.yml
|
|
|
|
volumes:
|
|
|
|
volumes:
|
|
|
|
- /mnt/lotus-land-story/loki/config:/mnt/config
|
|
|
|
- /mnt/lotus-land-story/loki/config:/mnt/config
|
|
|
|
- /mnt/lotus-land-story/loki/data:/data
|
|
|
|
- /mnt/lotus-land-story/loki/data:/data
|
|
|
|
restart: unless-stopped
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
extra_hosts:
|
|
|
|
networks:
|
|
|
|
- "host.docker.internal:host-gateway"
|
|
|
|
- name: lotus_land_story
|
|
|
|
|
|
|
|
etc_hosts:
|
|
|
|
|
|
|
|
host.docker.internal: host-gateway
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Run Promtail
|
|
|
|
|
|
|
|
community.docker.docker_container:
|
|
|
|
|
|
|
|
# recreate: true
|
|
|
|
|
|
|
|
# restart: true
|
|
|
|
|
|
|
|
name: promtail
|
|
|
|
|
|
|
|
image: grafana/promtail:2.8.0
|
|
|
|
|
|
|
|
command: -config.file=/mnt/config/promtail.yml
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
|
|
|
- /var/log:/var/log
|
|
|
|
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
|
|
|
|
- /mnt/lotus-land-story/loki/config:/mnt/config
|
|
|
|
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
|
|
|
- name: lotus_land_story
|
|
|
|
|
|
|
|
etc_hosts:
|
|
|
|
|
|
|
|
host.docker.internal: host-gateway
|
|
|
|
|
|
|
|
|
|
|
|
# vim: ft=yaml.ansible
|
|
|
|
# vim: ft=yaml.ansible
|
|
|
|