File tree Expand file tree Collapse file tree 11 files changed +211
-0
lines changed Expand file tree Collapse file tree 11 files changed +211
-0
lines changed Original file line number Diff line number Diff line change 11grafana_port : 8443
2+ LOKI : false
3+
Original file line number Diff line number Diff line change 1+ auth_enabled : false
2+
3+ server :
4+ http_listen_port : 3100
5+ grpc_listen_port : 9096
6+
7+ ingester :
8+ lifecycler :
9+ address : 127.0.0.1
10+ ring :
11+ kvstore :
12+ store : inmemory
13+ replication_factor : 1
14+ final_sleep : 0s
15+ chunk_idle_period : 5m
16+ chunk_retain_period : 30s
17+ max_transfer_retries : 0
18+
19+ schema_config :
20+ configs :
21+ - from : 2018-04-15
22+ store : boltdb
23+ object_store : filesystem
24+ schema : v11
25+ index :
26+ prefix : index_
27+ period : 168h
28+
29+ storage_config :
30+ boltdb :
31+ directory : /data/loki/index
32+
33+ filesystem :
34+ directory : /data/loki/chunks
35+
36+ limits_config :
37+ enforce_metric_name : false
38+ reject_old_samples : true
39+ reject_old_samples_max_age : 168h
40+
41+ chunk_store_config :
42+ max_look_back_period : 0s
43+
44+ table_manager :
45+ retention_deletes_enabled : false
46+ retention_period : 0s
47+
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description =Loki service
3+ After =network.target
4+
5+ [Service]
6+ Type =simple
7+ ExecStart =/usr/bin/loki-linux-amd64 --config.file /etc/grafana/loki/loki-local-config.yaml
8+
9+ [Install]
10+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change 2424 name : grafana-server
2525 enabled : true
2626 state : restarted
27+
28+ - name : restart loki
29+ service :
30+ name : loki
31+ enabled : yes
32+ state : restarted
33+
Original file line number Diff line number Diff line change 2626 dest : /etc/prometheus/prometheus.yml
2727 notify : restart prometheus
2828
29+ # Setup loki which gathers our logs
30+ - name : Install loki
31+ unarchive :
32+ src : https://github.com/grafana/loki/releases/download/v2.5.0/loki-linux-amd64.zip
33+ dest : /usr/bin/
34+ remote_src : true
35+ owner : domjudge
36+ group : domjudge
37+ when : LOKI
38+
39+ - name : Dir for loki settings
40+ file :
41+ state : directory
42+ path : /etc/grafana/loki/
43+ owner : root
44+ group : root
45+ mode : 0755
46+ when : LOKI
47+
48+ - name : Set loki settings
49+ copy :
50+ src : loki-local-config.yaml
51+ dest : /etc/grafana/loki/
52+ owner : root
53+ group : root
54+ mode : 0644
55+ when : LOKI
56+ notify : restart loki
57+
58+ - name : Setup loki systemd
59+ copy :
60+ src : loki.service
61+ dest : /etc/systemd/system/
62+ mode : 0655
63+ when : LOKI
64+ notify : restart loki
65+
66+ - name : Start loki service
67+ service :
68+ name : loki
69+ state : started
70+ enabled : true
71+ when : LOKI
72+
2973# # Setup grafana
3074- name : Install grafana
3175 apt :
Original file line number Diff line number Diff line change @@ -9,6 +9,20 @@ server {
99 proxy_pass http://127.0.0.1:3000/;
1010 proxy_read_timeout 90;
1111 }
12+
13+ {% if LOKI %}
14+ location /loki/ {
15+ proxy_set_header X-Forwarded-Proto https;
16+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17+ proxy_set_header X-Forwarded-Host $host;
18+ proxy_set_header X-Real-IP $remote_addr;
19+ proxy_pass http://localhost:3099/;
20+ proxy_buffering off;
21+ proxy_redirect off;
22+ proxy_set_header Host $host;
23+ }
24+ {% endif $}
25+
1226 access_log /var /log /nginx /prometheus .log ;
1327 error_log /var /log /nginx /prometheus .log ;
1428
Original file line number Diff line number Diff line change 1+ PROM : true
2+
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description =Promtail service
3+ After =network.target
4+
5+ [Service]
6+ Type =simple
7+ ExecStart =/usr/bin/promtail-linux-amd64 --config.file /etc/promtail/promtail-local-config.yaml
8+
9+ [Install]
10+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change 1+ ---
2+ - name : restart promtail
3+ service :
4+ name : promtail
5+ enabled : yes
6+ state : restarted
7+ daemon_reload : true
8+
Original file line number Diff line number Diff line change 66 state : present
77 pkg :
88 - prometheus-node-exporter
9+
10+ # Setup promtail which sends our logs
11+ - name : Install promtail
12+ unarchive :
13+ src : https://github.com/grafana/loki/releases/download/v2.5.0/promtail-linux-amd64.zip
14+ dest : /usr/bin/
15+ remote_src : true
16+ owner : domjudge
17+ group : domjudge
18+ when : PROM
19+
20+ - name : Dir for promtail settings
21+ file :
22+ state : directory
23+ path : /etc/promtail
24+ owner : root
25+ group : root
26+ mode : 0755
27+ when : PROM
28+
29+ - name : Set promtail settings
30+ copy :
31+ src : promtail-local-config.yaml
32+ dest : /etc/promtail/
33+ owner : root
34+ group : root
35+ mode : 0644
36+ when : PROM
37+ notify : restart promtail
38+
39+ - name : Setup promtail systemd
40+ copy :
41+ src : promtail.service
42+ dest : /etc/systemd/system/
43+ mode : 0655
44+ owner : root
45+ group : root
46+ when : PROM
47+ notify : restart promtail
48+
49+ - name : Start promtail service
50+ service :
51+ name : promtail
52+ state : started
53+ enabled : true
54+ when : PROM
55+
You can’t perform that action at this time.
0 commit comments