I am trying to send logs from AWS lambda (which is printed to stdout) to aws opensearch backend using opentelemetry collector.
My configuration looks like this :
- I have central otel collector running inside vpc
- I followed this documentation – https://opentelemetry.io/docs/faas/lambda-collector/
- 2a. I added otel collector lambda layer to my function from here — https://github.com/open-telemetry/opentelemetry-lambda/releases
- 2b. I created custom otel collector config file at root of the project with following value :
receivers:
otlp:
protocols:
grpc:
endpoint: '0.0.0.0:4317'
http:
endpoint: '0.0.0.0:4318'
exporters:
debug:
verbosity: detailed
otlphttp:
endpoint: http://<my-central-otelcol-endpoint>:4318/v1/logs
tls:
insecure: true
service:
pipelines:
logs:
receivers:
- otlp
exporters:
- otlphttp
telemetry:
metrics:
address: localhost:8888
- 2c. I setup this env var in lambda — OPENTELEMETRY_COLLECTOR_CONFIG_FILE = /var/task/collector.yaml
My question is – is it even possible to send logs directly from aws lambda to other place using opentelemetry collector like this.
Also,
- I do not want to use opentelemetry SDK and its logging APIs inside code.
- and do not want to use cloudwatch logs subscription filter to stream logs to opensearch from cloudwatch logs