Skip to content

Commit 938eb7d

Browse files
committed
Add Vector configuration for log shipping
1 parent 9eafc26 commit 938eb7d

2 files changed

Lines changed: 87 additions & 2 deletions

File tree

kubernetes/namespaces/loki/README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Once this is deployed, the service `loki-gateway.loki.svc.cluster.local` will po
1111
```
1212
$ helm repo add grafana https://grafana.github.io/helm-charts
1313
$ helm repo update
14-
$ helm upgrade --install -n loki --values loki_values.yml loki grafana/loki
14+
$ helm upgrade --install -n loki --values loki/loki_values.yml loki grafana/loki
1515
```
1616

1717
## Alloy
@@ -21,5 +21,23 @@ $ helm upgrade --install -n loki --values loki_values.yml loki grafana/loki
2121
This requires no additional configuration, just make sure Loki is up and Alloy will start shipping logs.
2222

2323
```
24-
$ helm upgrade --install -n loki --values alloy_values.yml alloy grafana/alloy
24+
$ helm upgrade --install -n loki --values alloy/alloy_values.yml alloy grafana/alloy
2525
```
26+
27+
## Vector
28+
29+
Vector is a log shipping tool that we use to accept various sources and ships them to Loki.
30+
31+
```
32+
$ helm repo add vector https://helm.vector.dev
33+
$ helm repo update
34+
$ helm upgrade --install -n loki --values vector/vector_values.yml vector vector/vector
35+
```
36+
37+
### Vector Port Allocations
38+
39+
Log data will be tagged and retained based on the Vector endpoint it lands in.
40+
41+
| Port | Sending Service |
42+
| ---- | --------------- |
43+
| 6000 | Kubewatch |
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# role -- [Role](https://vector.dev/docs/setup/deployment/roles/) for this Vector instance, valid options are:
2+
# "Agent", "Aggregator", and "Stateless-Aggregator".
3+
4+
# Each role is created with the following workloads:
5+
# Agent = DaemonSet
6+
# Aggregator = StatefulSet
7+
# Stateless-Aggregator = Deployment
8+
role: "Stateless-Aggregator"
9+
10+
# customConfig -- Override Vector's default configs, if used **all** options need to be specified. This section supports
11+
# using helm templates to populate dynamic values. See Vector's [configuration documentation](https://vector.dev/docs/reference/configuration/)
12+
# for all options.
13+
customConfig:
14+
data_dir: /vector-data-dir
15+
16+
api:
17+
enabled: true
18+
address: 127.0.0.1:8686
19+
20+
sources:
21+
kubewatch:
22+
address: 0.0.0.0:6000
23+
type: http_server
24+
auth:
25+
strategy: custom
26+
source: |-
27+
true
28+
decoding:
29+
codec: json
30+
framing:
31+
method: bytes
32+
33+
transforms:
34+
kubewatch_prepared:
35+
type: remap
36+
inputs: [kubewatch]
37+
source: |-
38+
.job = "kubewatch"
39+
.kind = .eventmeta.kind
40+
.name = .eventmeta.name
41+
.namespace = .eventmeta.namespace
42+
.reason = .eventmeta.reason
43+
44+
.labels = {
45+
"namespace": .eventmeta.namespace,
46+
"kind": .eventmeta.kind,
47+
}
48+
49+
del(.source_type)
50+
del(.path)
51+
del(.eventmeta)
52+
53+
sinks:
54+
loki:
55+
type: loki
56+
inputs: [kubewatch_prepared]
57+
endpoint: http://loki:3100
58+
labels:
59+
job: |-
60+
{{`vector.{{ job }}`}}
61+
"*": |-
62+
{{`{{ labels }}`}}
63+
encoding:
64+
codec: json
65+
66+
# Log level for Vector.
67+
logLevel: "info"

0 commit comments

Comments
 (0)