-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstuff.yml
127 lines (117 loc) · 3.29 KB
/
stuff.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
- name: AWS
ansible.builtin.import_role:
name: inqwise.common.aws
vars:
dns_record_list:
- name: "{{ private_dns }}.{{ private_domain }}"
zone: "{{ private_domain }}"
type: A
value: "{{ private_ip }}"
private: true
ttl: 120
- name: Java role
ansible.builtin.include_role:
name: inqwise.common.java
tags: installation
- name: Consul Agent role
ansible.builtin.import_role:
name: inqwise.common.consul
vars:
consul_bind_addr: "{{ private_ip }}"
consul_retry_join: '["consul.{{ private_domain }}"]'
consul_datacenter: "{{ environment_name }}-dc-1"
consul_server: false
consul_ui: false
consul_services:
- name: "opinion-rest-api"
tags:
- "app"
- "rest-api"
port: 8083
- name: "opinion-jetty"
tags:
- "app"
- "jetty"
port: 8080
- name: Include opinion role
ansible.builtin.include_role:
name: opinion
vars:
user: "{{ app_user }}"
group: "{{ app_group }}"
collaboration_base: "{{ opinion_base_path }}"
discord_webhook_error_log: "{{ discord_webhooks.apilog | default(discord_webhooks.default) }}"
tags: always
- name: Install Alloy
include_role:
name: alloy
vars:
alloy_user_groups:
- systemd-journal
- "{{ app_group }}"
config: |
loki.write "local" {
endpoint {
url = "{{ loki_base_url }}/loki/api/v1/push"
}
}
loki.relabel "journal" {
forward_to = []
rule {
source_labels = ["__journal__systemd_unit"]
regex = "(jetty.service|opinion-api.service|opinion-automation.service|telegraf.service)"
action = "keep"
}
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}
rule {
source_labels = ["__journal__hostname"]
target_label = "instance"
}
}
loki.source.journal "read" {
forward_to = [
loki.write.local.receiver,
]
relabel_rules = loki.relabel.journal.rules
labels = {
"job" = "integrations/node_exporter",
"app" = "opinion",
}
}
local.file_match "opinion_log_files" {
path_targets = [{"__path__" = "/data/opinion/logs/*.log"}]
sync_period = "10s"
}
loki.source.file "opinion_log_files_scrape" {
targets = local.file_match.opinion_log_files.targets
forward_to = [loki.process.opinion_log_files_filter.receiver]
tail_from_end = true
}
loki.process "opinion_log_files_filter" {
stage.multiline {
firstline = "^(?P<timestamp>[0-9\\-]{10} [0-9:]{8},[0-9]{3}) (?P<level>[^ ]+)"
}
stage.regex {
expression = "^(?P<timestamp>[0-9\\-]{10} [0-9:]{8},[0-9]{3}) (?P<level>[^ ]+) (?P<logger>[^ ]+) \\[(?P<thread>[^\\]]+)\\] (?P<message>.*)$"
}
stage.labels {
values = {
"level" = "level",
"logger" = "logger",
"timestamp" = "timestamp",
}
}
stage.static_labels {
values = {
"app" = "opinion",
}
}
forward_to = [
loki.write.local.receiver,
]
}
tags: always