Skip to content

Commit 328e313

Browse files
authored
fix(job-logs-collector): Fix routing to otel-router (#2599)
vector can't actually convert to otel log format
1 parent e43d497 commit 328e313

13 files changed

Lines changed: 45 additions & 10 deletions

File tree

iac/modules/job-logs-collector/configs/vector.toml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,18 @@ category = "{{ category }}"
113113

114114
%{ if enable_otel_router_logs }
115115
[sinks.otel_router_non_internal]
116-
type = "opentelemetry"
116+
type = "http"
117117
inputs = [ "remove_internal" ]
118+
uri = "http://127.0.0.1:${otel_router_http_port}/logs"
119+
method = "post"
118120
healthcheck.enabled = false
119121
buffer.type = "memory"
120122
buffer.max_events = 500
121123
buffer.when_full = "drop_newest"
124+
encoding.codec = "json"
125+
framing.method = "newline_delimited"
122126

123-
[sinks.otel_router_non_internal.protocol]
124-
type = "http"
125-
uri = "http://otel-router.service.consul:4318/v1/logs"
126-
method = "post"
127-
128-
[sinks.otel_router_non_internal.protocol.encoding]
129-
codec = "otlp"
130-
131-
[sinks.otel_router_non_internal.protocol.request]
127+
[sinks.otel_router_non_internal.request]
132128
retry_attempts = 0
133129
timeout_secs = 2
134130
%{ endif }

iac/modules/job-logs-collector/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ locals {
1111
grafana_api_key = var.grafana_api_key
1212

1313
enable_otel_router_logs = var.enable_otel_router_logs
14+
otel_router_http_port = var.otel_router_http_port
1415
},
1516
)
1617

iac/modules/job-logs-collector/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ variable "enable_otel_router_logs" {
3333
description = "Enable teeing non-internal customer logs from Vector to otel-router."
3434
}
3535

36+
variable "otel_router_http_port" {
37+
type = number
38+
default = 4321
39+
description = "Local otel-router Vector-compatible logs port used by Vector when otel-router log teeing is enabled."
40+
}
41+
3642
variable "vector_config_override" {
3743
type = string
3844
default = ""

iac/provider-aws/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ tf_vars := AWS_PROFILE=$(AWS_PROFILE) AWS_REGION=$(AWS_REGION) \
4343
$(call tfvar, BUILD_SERVER_NESTED_VIRTUALIZATION) \
4444
$(call tfvar, AWS_ACCOUNT_ID) \
4545
$(call tfvar, AWS_REGION) \
46+
$(call tfvar, ENABLE_OTEL_ROUTER_LOGS) \
47+
$(call tfvar, OTEL_ROUTER_HTTP_PORT) \
4648
$(call tfvar, DB_MAX_OPEN_CONNECTIONS) \
4749
$(call tfvar, DB_MIN_IDLE_CONNECTIONS) \
4850
$(call tfvar, AUTH_DB_MAX_OPEN_CONNECTIONS) \

iac/provider-aws/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ module "nomad" {
231231
launch_darkly_api_key = module.init.launch_darkly_api_key
232232

233233
enable_otel_router_logs = var.enable_otel_router_logs
234+
otel_router_http_port = var.otel_router_http_port
234235

235236
db_max_open_connections = var.db_max_open_connections
236237
db_min_idle_connections = var.db_min_idle_connections

iac/provider-aws/nomad/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ module "logs_collector" {
272272
loki_endpoint = "http://loki.service.consul:${var.loki_port}"
273273

274274
enable_otel_router_logs = var.enable_otel_router_logs
275+
otel_router_http_port = var.otel_router_http_port
275276

276277
vector_health_port = var.logs_health_proxy_port
277278
vector_api_port = var.logs_proxy_port

iac/provider-aws/nomad/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ variable "enable_otel_router_logs" {
303303
description = "Enable teeing non-internal customer logs from Vector to otel-router."
304304
}
305305

306+
variable "otel_router_http_port" {
307+
type = number
308+
default = 4321
309+
description = "Local otel-router Vector-compatible logs port used by Vector when otel-router log teeing is enabled."
310+
}
311+
306312
# Feature flags
307313
variable "launch_darkly_api_key" {
308314
type = string

iac/provider-aws/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,9 @@ variable "enable_otel_router_logs" {
198198
default = false
199199
description = "Enable teeing non-internal customer logs from Vector to otel-router."
200200
}
201+
202+
variable "otel_router_http_port" {
203+
type = number
204+
default = 4321
205+
description = "Local otel-router Vector-compatible logs port used by Vector when otel-router log teeing is enabled."
206+
}

iac/provider-gcp/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ tf_vars := \
5959
$(call tfvar, LOKI_RESOURCES_MEMORY_MB) \
6060
$(call tfvar, OTEL_COLLECTOR_RESOURCES_CPU_COUNT) \
6161
$(call tfvar, OTEL_COLLECTOR_RESOURCES_MEMORY_MB) \
62+
$(call tfvar, ENABLE_OTEL_ROUTER_LOGS) \
63+
$(call tfvar, OTEL_ROUTER_HTTP_PORT) \
6264
$(call tfvar, TEMPLATE_BUCKET_NAME) \
6365
$(call tfvar, TEMPLATE_BUCKET_LOCATION) \
6466
$(call tfvar, ENVD_TIMEOUT) \

iac/provider-gcp/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ module "nomad" {
286286
otel_collector_resources_memory_mb = var.otel_collector_resources_memory_mb
287287
otel_collector_resources_cpu_count = var.otel_collector_resources_cpu_count
288288
enable_otel_router_logs = var.enable_otel_router_logs
289+
otel_router_http_port = var.otel_router_http_port
289290

290291
# Dashboard API
291292
dashboard_api_count = var.dashboard_api_count

0 commit comments

Comments
 (0)