Skip to content

Commit e9e6082

Browse files
Merge pull request #4038 from SwiftPackageIndex/move-to-alloy
Move to alloy
2 parents 11d627a + 5719425 commit e9e6082

File tree

3 files changed

+64
-51
lines changed

3 files changed

+64
-51
lines changed

infrastructure/config.alloy

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
loki.process "system" {
16+
forward_to = [loki.write.default.receiver]
17+
18+
stage.docker { }
19+
20+
stage.regex {
21+
expression = "\\[component:\\s*(?P<component>[\\w,-]+)\\]"
22+
}
23+
24+
stage.labels {
25+
values = {
26+
component = null,
27+
}
28+
}
29+
30+
stage.drop {
31+
// Drop Grafana logs so we don't do the "grep greps its own output"-thing
32+
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/839
33+
expression = "caller=metrics.go:"
34+
}
35+
}
36+
37+
loki.source.file "system" {
38+
targets = [{
39+
__address__ = "localhost",
40+
__path__ = "/var/log/*/*.log",
41+
job = "containers",
42+
}]
43+
forward_to = [loki.process.system.receiver]
44+
45+
file_match {
46+
enabled = true
47+
}
48+
legacy_positions_file = "/tmp/positions.yaml"
49+
}
50+
51+
loki.write "default" {
52+
endpoint {
53+
url = "http://loki:3100/loki/api/v1/push"
54+
}
55+
external_labels = {}
56+
}

infrastructure/promtail.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

mon.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ services:
5151
- app_backend
5252

5353

54-
promtail:
55-
# https://github.com/grafana/loki/releases
56-
# (promtail is released in parallel with loki)
57-
image: grafana/promtail:3.5.1
58-
command: -config.file=/promtail.yml
54+
alloy:
55+
# https://github.com/grafana/alloy/releases
56+
image: grafana/alloy:v1.15.1
57+
command: run /config.alloy
5958
configs:
60-
- source: promtail_cfg
61-
target: /promtail.yml
59+
- source: alloy_cfg
60+
target: /config.alloy
6261
volumes:
6362
- /var/lib/docker/containers:/var/log
6463
networks:
@@ -129,8 +128,8 @@ services:
129128
configs:
130129
loki_cfg:
131130
file: ./infrastructure/loki.yml
132-
promtail_cfg:
133-
file: ./infrastructure/promtail.yml
131+
alloy_cfg:
132+
file: ./infrastructure/config.alloy
134133
prometheus_cfg:
135134
file: ./infrastructure/prometheus.yml
136135

0 commit comments

Comments
 (0)