diff --git a/collector/config.combined.yaml b/collector/config.combined.yaml index fd97cb11ad..bf02f41b5f 100644 --- a/collector/config.combined.yaml +++ b/collector/config.combined.yaml @@ -29,7 +29,17 @@ processors: action: delete - key: process.tags action: delete - + # Console output during an invocation arrives over OTLP from the Logz.io hooks, with trace and span IDs. + # Drop the Telemetry API copy of those lines so they are not sent twice, and Lambda's per-invocation + # START and END lines. Platform records and output written outside an invocation (init, crashes) are kept. + filter/invocation-output: + error_mode: ignore + logs: + log_record: + # Runtime line format: "\t\t\t"; init lines carry "undefined". + - 'attributes["type"] == "function" and IsMatch(body, "^\\S+\\t[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\t")' + - 'attributes["type"] == "platform.start" or attributes["type"] == "platform.runtimeDone"' + exporters: logzio/logs: account_token: "${env:LOGZIO_LOGS_TOKEN}" @@ -60,9 +70,13 @@ service: processors: [batch] exporters: [prometheusremotewrite] logs: - receivers: [telemetryapireceiver] + receivers: [otlp] processors: [batch] exporters: [logzio/logs] + logs/telemetryapi: + receivers: [telemetryapireceiver] + processors: [filter/invocation-output, batch] + exporters: [logzio/logs] telemetry: logs: level: "info" diff --git a/collector/config_test.go b/collector/config_test.go index 8a65e7c192..6b10e2a4ab 100644 --- a/collector/config_test.go +++ b/collector/config_test.go @@ -33,11 +33,15 @@ import ( func TestShippedConfigsAreValid(t *testing.T) { t.Setenv("LOGZIO_GATEWAY_ENDPOINT", "https://gateway.example.com") t.Setenv("LOGZIO_GATEWAY_TOKEN", "test-token") + t.Setenv("LOGZIO_TRACES_TOKEN", "test-token") + t.Setenv("LOGZIO_LOGS_TOKEN", "test-token") + t.Setenv("LOGZIO_METRICS_TOKEN", "test-token") + t.Setenv("LOGZIO_REGION", "us") factories, err := lambdacomponents.Components("collector") require.NoError(t, err) - for _, file := range []string{"config.gateway.yaml", "config.gateway-traces.yaml"} { + for _, file := range []string{"config.combined.yaml", "config.gateway.yaml", "config.gateway-traces.yaml"} { t.Run(file, func(t *testing.T) { provider, err := otelcol.NewConfigProvider(otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{