Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions component-constructor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,27 @@ components:
type: ociArtifact
imageReference: "${KUSTOMIZATIONS_LOCATION_PREFIX}/metrics:${OBSERVABILITY_STACK_VERSION}"

# observability gateway
- name: observability-gateway-kustomization
version: ${OBSERVABILITY_STACK_VERSION}
type: kustomization
access:
type: ociArtifact
imageReference: "${KUSTOMIZATIONS_LOCATION_PREFIX}/observability-gateway:${OBSERVABILITY_STACK_VERSION}"

# victoria logs
- name: victoria-logs-kustomization
version: ${OBSERVABILITY_STACK_VERSION}
type: kustomization
access:
type: ociArtifact
imageReference: "${KUSTOMIZATIONS_LOCATION_PREFIX}/victoria-logs:${OBSERVABILITY_STACK_VERSION}"

- name: victoria-logs-image
version: ${VICTORIA_LOGS_IMAGE_VERSION}
type: ociImage
input:
type: ociImage
path: "docker.io/victoriametrics/victoria-logs:${VICTORIA_LOGS_IMAGE_VERSION}"
repository: images/victoria-logs

3 changes: 3 additions & 0 deletions component-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ PROMETHEUS_IMAGE_VERSION: "v3.10.0"
# prometheus alertmanager
ALERTMANAGER_IMAGE_VERSION: "v0.31.1"

# victoria logs
VICTORIA_LOGS_IMAGE_VERSION: "v1.6.0-victorialogs"


# E2E Test dependencies
# Not used for deployment
Expand Down
1 change: 1 addition & 0 deletions hack/build-component.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def push_kustomizations(repo_root: Path, version: str) -> None:
("prometheus-operator", "prometheus-operator"),
("prometheus", "prometheus"),
("metrics", "metrics"),
("victoria-logs", "victoria-logs")
]

# Get git information
Expand Down
65 changes: 65 additions & 0 deletions kustomizations/observability-gateway/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: observability-gateway
spec:
gatewayClassName: envoy-gateway
listeners:
- name: prometheus
port: 8443
protocol: HTTPS
hostname: "<prometheus-dnsname>"
allowedRoutes:
namespaces:
from: All
tls:
mode: Terminate
certificateRefs:
- kind: Secret
name: prometheus-cert
- name: victoria-logs
port: 8443
protocol: HTTPS
hostname: "<victoria-logs-dnsname>"
allowedRoutes:
namespaces:
from: All
tls:
mode: Terminate
certificateRefs:
- kind: Secret
name: victoria-logs-cert
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: prometheus-mtls
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: observability-gateway
sectionName: prometheus
tls:
clientValidation:
caCertificateRefs:
- kind: "Secret"
group: ""
name: "prometheus-client-ca-cert"
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: victoria-logs-mtls
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: observability-gateway
sectionName: victoria-logs
tls:
clientValidation:
caCertificateRefs:
- kind: "Secret"
group: ""
name: "victoria-logs-client-ca-cert"
7 changes: 7 additions & 0 deletions kustomizations/observability-gateway/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gateway.yaml
- gateway-issuer.yaml
- prometheus-certificates.yaml
- victoria-logs-certificates.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: prometheus-gateway-cert
spec:
secretName: prometheus-cert
issuerRef:
name: gateway-selfsigned-issuer
kind: Issuer
dnsNames:
- "<dnsname>"
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: prometheus-client-ca
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: victoria-logs-gateway-cert
spec:
secretName: victoria-logs-cert
issuerRef:
name: gateway-selfsigned-issuer
kind: Issuer
dnsNames:
- "<dnsname>"
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: victoria-logs-client-ca
spec:
isCA: true
commonName: victoria-logs-client-ca
secretName: victoria-logs-client-ca-cert
privateKey:
algorithm: RSA
size: 2048
issuerRef:
name: gateway-selfsigned-issuer
kind: Issuer
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: victoria-logs-client-issuer
spec:
ca:
secretName: victoria-logs-client-ca-cert
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: victoria-logs-client-cert
spec:
secretName: victoria-logs-client-cert
commonName: victoria-logs-client
usages:
- client auth
issuerRef:
name: victoria-logs-client-issuer
kind: Issuer
1 change: 1 addition & 0 deletions kustomizations/opentelemetry-collector/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- collector.yaml
- log-collector.yaml
- servicemonitor.yaml
111 changes: 111 additions & 0 deletions kustomizations/opentelemetry-collector/log-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: open-telemetry-log-collector
---
apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
name: logs
spec:
mode: daemonset
serviceAccount: open-telemetry-log-collector
securityContext:
runAsUser: 0
config:
receivers:
filelog:
include:
- /var/log/pods/*/*/*.log
start_at: beginning
include_file_path: true
include_file_name: false
operators:
# Route to the correct parser based on container runtime format
- type: router
id: get-format
routes:
- output: parser-docker
expr: 'body matches "^\\{"'
default: parser-containerd

# Docker JSON format (e.g. Docker Desktop, older clusters)
- type: json_parser
id: parser-docker
output: move-log-to-body
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'

# Containerd / CRI-O space-delimited format (most modern clusters)
- type: regex_parser
id: parser-containerd
regex: '^(?P<time>[^ Z]+Z) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$'
output: move-log-to-body
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'

# Move the parsed log field to body (both Docker and containerd / CRI-O)
- type: move
id: move-log-to-body
from: attributes.log
to: body
output: extract-pod-metadata

# Extract pod metadata (namespace, pod name, uid, container) from the file path
- type: regex_parser
id: extract-pod-metadata
parse_from: attributes["log.file.path"]
regex: '^/var/log/pods/(?P<k8s_namespace>[^_]+)_(?P<k8s_pod>[^_]+)_(?P<k8s_uid>[^/]+)/(?P<k8s_container>[^/]+)/\d+\.log$'
cache:
size: 128

# If the log body is JSON, promote its fields to attributes so Victoria Logs
# indexes them as individual fields. parse_to: attributes leaves body (= _msg)
# unchanged, so the original JSON string is always retained.
- type: json_parser
id: parse-json-body
parse_from: body
parse_to: attributes
if: 'body matches "^\\s*\\{"'
on_error: send

processors:
memory_limiter:
check_interval: 1s
limit_percentage: 75
spike_limit_percentage: 15
# Flatten nested attribute maps produced by json_parser so that nested
# objects (e.g. Cluster: {name, namespace}) become dot-separated scalar
# attributes (Cluster.name, Cluster.namespace) instead of KeyValueList
# values, which Victoria Logs serialises in an ugly AnyValue representation.
transform:
log_statements:
- context: log
statements:
- flatten(attributes, "", 10)
batch: {}

exporters:
otlphttp:
endpoint: "http://victoria-logs.victoria-logs-system.svc.cluster.local:9428/insert/opentelemetry"
tls:
insecure: true

service:
pipelines:
logs:
receivers: [filelog]
processors: [memory_limiter, transform, batch]
exporters: [otlphttp]

volumeMounts:
- name: varlogpods
mountPath: /var/log/pods
readOnly: true

volumes:
- name: varlogpods
hostPath:
path: /var/log/pods
11 changes: 0 additions & 11 deletions kustomizations/prometheus/gateway-certificate.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions kustomizations/prometheus/gateway.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions kustomizations/prometheus/httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: prometheus
spec:
parentRefs:
- name: prometheus
namespace: prometheus-system
- name: observability-gateway
namespace: observability-gateway-system
sectionName: prometheus
hostnames: []
rules:
- matches:
Expand Down
4 changes: 0 additions & 4 deletions kustomizations/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@ kind: Kustomization
resources:
- prometheus.yaml
- alertmanager.yaml
- gateway.yaml
- gateway-issuer.yaml
- gateway-certificate.yaml
- client-certificates.yaml
- httproute.yaml
18 changes: 18 additions & 0 deletions kustomizations/victoria-logs/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: victoria-logs
spec:
parentRefs:
- name: observability-gateway
namespace: observability-gateway-system
sectionName: victoria-logs
hostnames: []
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: victoria-logs
port: 9428
5 changes: 5 additions & 0 deletions kustomizations/victoria-logs/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- victoria-logs.yaml
- httproute.yaml
Loading
Loading