Skip to content

Commit db93317

Browse files
committed
using Vector otlp sink
Signed-off-by: Vitalii Parfonov <[email protected]>
1 parent bc08169 commit db93317

File tree

12 files changed

+100
-111
lines changed

12 files changed

+100
-111
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export LOGGING_VERSION?=6.3
2525
export VERSION=$(LOGGING_VERSION).0
2626
export NAMESPACE?=openshift-logging
2727

28-
IMAGE_LOGGING_VECTOR?=quay.io/openshift-logging/vector:v0.37.1
28+
IMAGE_LOGGING_VECTOR?=qquay.io/vparfono/vector:v0.46.1-rh
2929
IMAGE_LOGFILEMETRICEXPORTER?=quay.io/openshift-logging/log-file-metric-exporter:6.1
3030
IMAGE_LOGGING_EVENTROUTER?=quay.io/openshift-logging/eventrouter:0.3
3131

@@ -217,7 +217,7 @@ test-env: ## Echo test environment, useful for running tests outside of the Make
217217

218218
.PHONY: test-functional
219219
test-functional: test-functional-benchmarker-vector
220-
RELATED_IMAGE_VECTOR=$(IMAGE_LOGGING_VECTOR) \
220+
RELATED_IMAGE_VECTOR=quay.io/vparfono/vector:v0.46.1-rh \
221221
RELATED_IMAGE_LOG_FILE_METRIC_EXPORTER=$(IMAGE_LOGFILEMETRICEXPORTER) \
222222
go test -race \
223223
./test/functional/... \

bundle/manifests/cluster-logging.clusterserviceversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,7 @@ spec:
21182118
- name: OPERATOR_NAME
21192119
value: cluster-logging-operator
21202120
- name: RELATED_IMAGE_VECTOR
2121-
value: quay.io/openshift-logging/vector:v0.37.1
2121+
value: quay.io/vparfono/vector:v0.46.1-rh
21222122
- name: RELATED_IMAGE_LOG_FILE_METRIC_EXPORTER
21232123
value: quay.io/openshift-logging/log-file-metric-exporter:6.1
21242124
image: quay.io/openshift-logging/cluster-logging-operator:latest
@@ -2165,7 +2165,7 @@ spec:
21652165
provider:
21662166
name: Red Hat
21672167
relatedImages:
2168-
- image: quay.io/openshift-logging/vector:v0.37.1
2168+
- image: quay.io/vparfono/vector:v0.46.1-rh
21692169
name: vector
21702170
- image: quay.io/openshift-logging/log-file-metric-exporter:6.1
21712171
name: log-file-metric-exporter

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ spec:
4848
- name: OPERATOR_NAME
4949
value: "cluster-logging-operator"
5050
- name: RELATED_IMAGE_VECTOR
51-
value: quay.io/openshift-logging/vector:v0.37.1
51+
value: quay.io/vparfono/vector:v0.46.1-rh
5252
- name: RELATED_IMAGE_LOG_FILE_METRIC_EXPORTER
5353
value: quay.io/openshift-logging/log-file-metric-exporter:6.1

internal/generator/vector/output/lokistack/lokistack_otel.toml

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,20 @@ source = '''
120120
'''
121121

122122
[sinks.output_default_lokistack_application]
123-
type = "http"
123+
type = "opentelemetry"
124124
inputs = ["output_default_lokistack_application_resource_logs"]
125-
uri = "https://logging-loki-gateway-http.openshift-logging.svc:8080/api/logs/v1/application/otlp/v1/logs"
126-
method = "post"
127-
payload_prefix = "{\"resourceLogs\":"
128-
payload_suffix = "}"
129-
130-
[sinks.output_default_lokistack_application.encoding]
131-
codec = "json"
132-
except_fields = ["_internal"]
133-
134-
[sinks.output_default_lokistack_application.tls]
125+
protocol.uri = "https://logging-loki-gateway-http.openshift-logging.svc:8080/api/logs/v1/application/otlp/v1/logs"
126+
protocol.type = "http"
127+
protocol.method = "post"
128+
protocol.encoding.codec = "json"
129+
protocol.encoding.except_fields = ["_internal"]
130+
protocol.payload_prefix = "{\"resourceLogs\":"
131+
protocol.payload_suffix = "}"
132+
133+
[sinks.output_default_lokistack_application.protocol.tls]
135134
ca_file = "/var/run/ocp-collector/config/openshift-service-ca.crt/ca-bundle.crt"
136135

137-
[sinks.output_default_lokistack_application.auth]
136+
[sinks.output_default_lokistack_application.protocol.auth]
138137
strategy = "bearer"
139138
token = "SECRET[kubernetes_secret.test-sa-token/token]"
140139

@@ -469,21 +468,20 @@ source = '''
469468
'''
470469

471470
[sinks.output_default_lokistack_audit]
472-
type = "http"
471+
type = "opentelemetry"
473472
inputs = ["output_default_lokistack_audit_resource_logs"]
474-
uri = "https://logging-loki-gateway-http.openshift-logging.svc:8080/api/logs/v1/audit/otlp/v1/logs"
475-
method = "post"
476-
payload_prefix = "{\"resourceLogs\":"
477-
payload_suffix = "}"
478-
479-
[sinks.output_default_lokistack_audit.encoding]
480-
codec = "json"
481-
except_fields = ["_internal"]
482-
483-
[sinks.output_default_lokistack_audit.tls]
473+
protocol.uri = "https://logging-loki-gateway-http.openshift-logging.svc:8080/api/logs/v1/audit/otlp/v1/logs"
474+
protocol.type = "http"
475+
protocol.method = "post"
476+
protocol.encoding.codec = "json"
477+
protocol.encoding.except_fields = ["_internal"]
478+
protocol.payload_prefix = "{\"resourceLogs\":"
479+
protocol.payload_suffix = "}"
480+
481+
[sinks.output_default_lokistack_audit.protocol.tls]
484482
ca_file = "/var/run/ocp-collector/config/openshift-service-ca.crt/ca-bundle.crt"
485483

486-
[sinks.output_default_lokistack_audit.auth]
484+
[sinks.output_default_lokistack_audit.protocol.auth]
487485
strategy = "bearer"
488486
token = "SECRET[kubernetes_secret.test-sa-token/token]"
489487

@@ -684,21 +682,19 @@ source = '''
684682
'''
685683

686684
[sinks.output_default_lokistack_infrastructure]
687-
type = "http"
685+
type = "opentelemetry"
688686
inputs = ["output_default_lokistack_infrastructure_resource_logs"]
689-
uri = "https://logging-loki-gateway-http.openshift-logging.svc:8080/api/logs/v1/infrastructure/otlp/v1/logs"
690-
method = "post"
691-
payload_prefix = "{\"resourceLogs\":"
692-
payload_suffix = "}"
693-
694-
[sinks.output_default_lokistack_infrastructure.encoding]
695-
codec = "json"
696-
except_fields = ["_internal"]
697-
698-
[sinks.output_default_lokistack_infrastructure.tls]
687+
protocol.uri = "https://logging-loki-gateway-http.openshift-logging.svc:8080/api/logs/v1/infrastructure/otlp/v1/logs"
688+
protocol.type = "http"
689+
protocol.method = "post"
690+
protocol.encoding.codec = "json"
691+
protocol.encoding.except_fields = ["_internal"]
692+
protocol.payload_prefix = "{\"resourceLogs\":"
693+
protocol.payload_suffix = "}"
694+
695+
[sinks.output_default_lokistack_infrastructure.protocol.tls]
699696
ca_file = "/var/run/ocp-collector/config/openshift-service-ca.crt/ca-bundle.crt"
700697

701-
[sinks.output_default_lokistack_infrastructure.auth]
698+
[sinks.output_default_lokistack_infrastructure.protocol.auth]
702699
strategy = "bearer"
703-
token = "SECRET[kubernetes_secret.test-sa-token/token]"
704-
700+
token = "SECRET[kubernetes_secret.test-sa-token/token]"

internal/generator/vector/output/otlp/otlp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func New(id string, o obs.OutputSpec, inputs []string, secrets observability.Sec
154154
common.NewBatch(protocolId, strategy),
155155
common.NewBuffer(id, strategy),
156156
common.NewRequest(protocolId, strategy),
157-
tls.New(id, o.TLS, secrets, op),
157+
tls.New(protocolId, o.TLS, secrets, op),
158158
auth.HTTPAuth(protocolId, o.OTLP.Authentication, secrets, op),
159159
},
160160
)

internal/generator/vector/output/otlp/otlp_all.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ r.attributes = append(r.attributes,
285285
]
286286
)
287287
if exists(.responseStatus.code) {
288-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
288+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
289289
}
290290
values = []
291291
for_each(array!(.user.groups)) -> |_index,group| {
@@ -368,7 +368,7 @@ r.attributes = append(r.attributes,
368368
]
369369
)
370370
if exists(.responseStatus.code) {
371-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
371+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
372372
}
373373
values = []
374374
for_each(array!(.user.groups)) -> |_index,group| {
@@ -495,13 +495,12 @@ source = '''
495495
'''
496496

497497
[sinks.output_otel_collector]
498-
type = "http"
498+
type = "opentelemetry"
499499
inputs = ["output_otel_collector_resource_logs"]
500-
uri = "http://localhost:4318/v1/logs"
501-
method = "post"
502-
payload_prefix = "{\"resourceLogs\":"
503-
payload_suffix = "}"
504-
505-
[sinks.output_otel_collector.encoding]
506-
codec = "json"
507-
except_fields = ["_internal"]
500+
protocol.uri = "http://localhost:4318/v1/logs"
501+
protocol.type = "http"
502+
protocol.method = "post"
503+
protocol.encoding.codec = "json"
504+
protocol.encoding.except_fields = ["_internal"]
505+
protocol.payload_prefix = "{\"resourceLogs\":"
506+
protocol.payload_suffix = "}"

internal/generator/vector/output/otlp/otlp_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@ package otlp
22

33
import (
44
"fmt"
5-
"time"
6-
7-
"github.com/openshift/cluster-logging-operator/internal/constants"
8-
corev1 "k8s.io/api/core/v1"
9-
105
. "github.com/onsi/ginkgo/v2"
116
. "github.com/onsi/gomega"
127
obs "github.com/openshift/cluster-logging-operator/api/observability/v1"
138
"github.com/openshift/cluster-logging-operator/internal/api/observability"
9+
"github.com/openshift/cluster-logging-operator/internal/constants"
1410
"github.com/openshift/cluster-logging-operator/internal/generator/framework"
1511
"github.com/openshift/cluster-logging-operator/internal/generator/vector/helpers"
1612
"github.com/openshift/cluster-logging-operator/internal/utils"
1713
"github.com/openshift/cluster-logging-operator/test/helpers/outputs/adapter/fake"
1814
. "github.com/openshift/cluster-logging-operator/test/matchers"
15+
corev1 "k8s.io/api/core/v1"
1916
"k8s.io/apimachinery/pkg/api/resource"
17+
"time"
2018
)
2119

2220
var _ = Describe("Generate vector config", func() {

internal/generator/vector/output/otlp/otlp_tuning.toml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ r.attributes = append(r.attributes,
285285
]
286286
)
287287
if exists(.responseStatus.code) {
288-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
288+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
289289
}
290290
values = []
291291
for_each(array!(.user.groups)) -> |_index,group| {
@@ -368,7 +368,7 @@ r.attributes = append(r.attributes,
368368
]
369369
)
370370
if exists(.responseStatus.code) {
371-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
371+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
372372
}
373373
values = []
374374
for_each(array!(.user.groups)) -> |_index,group| {
@@ -495,26 +495,25 @@ source = '''
495495
'''
496496

497497
[sinks.output_otel_collector]
498-
type = "http"
498+
type = "opentelemetry"
499499
inputs = ["output_otel_collector_resource_logs"]
500-
uri = "http://localhost:4318/v1/logs"
501-
method = "post"
502-
payload_prefix = "{\"resourceLogs\":"
503-
payload_suffix = "}"
504-
compression = "gzip"
500+
protocol.uri = "http://localhost:4318/v1/logs"
501+
protocol.type = "http"
502+
protocol.method = "post"
503+
protocol.encoding.codec = "json"
504+
protocol.encoding.except_fields = ["_internal"]
505+
protocol.payload_prefix = "{\"resourceLogs\":"
506+
protocol.payload_suffix = "}"
507+
protocol.compression = "gzip"
505508

506-
[sinks.output_otel_collector.encoding]
507-
codec = "json"
508-
except_fields = ["_internal"]
509-
510-
[sinks.output_otel_collector.batch]
509+
[sinks.output_otel_collector.protocol.batch]
511510
max_bytes = 10000000
512511

513512
[sinks.output_otel_collector.buffer]
514513
type = "disk"
515514
when_full = "block"
516515
max_size = 268435488
517516

518-
[sinks.output_otel_collector.request]
517+
[sinks.output_otel_collector.protocol.request]
519518
retry_initial_backoff_secs = 20
520519
retry_max_duration_secs = 35

internal/generator/vector/output/otlp/otlp_with_auth_basic.toml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ r.attributes = append(r.attributes,
285285
]
286286
)
287287
if exists(.responseStatus.code) {
288-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
288+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
289289
}
290290
values = []
291291
for_each(array!(.user.groups)) -> |_index,group| {
@@ -368,7 +368,7 @@ r.attributes = append(r.attributes,
368368
]
369369
)
370370
if exists(.responseStatus.code) {
371-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
371+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
372372
}
373373
values = []
374374
for_each(array!(.user.groups)) -> |_index,group| {
@@ -495,18 +495,17 @@ source = '''
495495
'''
496496

497497
[sinks.output_otel_collector]
498-
type = "http"
498+
type = "opentelemetry"
499499
inputs = ["output_otel_collector_resource_logs"]
500-
uri = "http://localhost:4318/v1/logs"
501-
method = "post"
502-
payload_prefix = "{\"resourceLogs\":"
503-
payload_suffix = "}"
500+
protocol.uri = "http://localhost:4318/v1/logs"
501+
protocol.type = "http"
502+
protocol.method = "post"
503+
protocol.encoding.codec = "json"
504+
protocol.encoding.except_fields = ["_internal"]
505+
protocol.payload_prefix = "{\"resourceLogs\":"
506+
protocol.payload_suffix = "}"
504507

505-
[sinks.output_otel_collector.encoding]
506-
codec = "json"
507-
except_fields = ["_internal"]
508-
509-
[sinks.output_otel_collector.auth]
508+
[sinks.output_otel_collector.protocol.auth]
510509
strategy = "basic"
511510
user = "SECRET[kubernetes_secret.otlp-receiver/username]"
512511
password = "SECRET[kubernetes_secret.otlp-receiver/password]"

internal/generator/vector/output/otlp/otlp_with_auth_sa_token.toml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ r.attributes = append(r.attributes,
285285
]
286286
)
287287
if exists(.responseStatus.code) {
288-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
288+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
289289
}
290290
values = []
291291
for_each(array!(.user.groups)) -> |_index,group| {
@@ -368,7 +368,7 @@ r.attributes = append(r.attributes,
368368
]
369369
)
370370
if exists(.responseStatus.code) {
371-
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
371+
r.attributes = push(r.attributes,{"key": "k8s.audit.event.response.code", "value": {"intValue": to_string!(.responseStatus.code)}})
372372
}
373373
values = []
374374
for_each(array!(.user.groups)) -> |_index,group| {
@@ -495,17 +495,16 @@ source = '''
495495
'''
496496

497497
[sinks.output_otel_collector]
498-
type = "http"
498+
type = "opentelemetry"
499499
inputs = ["output_otel_collector_resource_logs"]
500-
uri = "http://localhost:4318/v1/logs"
501-
method = "post"
502-
payload_prefix = "{\"resourceLogs\":"
503-
payload_suffix = "}"
500+
protocol.uri = "http://localhost:4318/v1/logs"
501+
protocol.type = "http"
502+
protocol.method = "post"
503+
protocol.encoding.codec = "json"
504+
protocol.encoding.except_fields = ["_internal"]
505+
protocol.payload_prefix = "{\"resourceLogs\":"
506+
protocol.payload_suffix = "}"
504507

505-
[sinks.output_otel_collector.encoding]
506-
codec = "json"
507-
except_fields = ["_internal"]
508-
509-
[sinks.output_otel_collector.auth]
508+
[sinks.output_otel_collector.protocol.auth]
510509
strategy = "bearer"
511510
token = "SECRET[kubernetes_secret.my-service-account-token/token]"

0 commit comments

Comments
 (0)