Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to forward messages from print, logging.info, logging.warning, etc. to logs pipeline via otlp exporter? #770

Open
ok512 opened this issue Jun 23, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ok512
Copy link

ok512 commented Jun 23, 2023

Is there a way to forward messages from print, logging.info, logging.warning, etc. to logs pipeline via otlp exporter?
Not sure, if a different receiver type should be used for logs, tho...

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: "localhost:4317"
      http:
        endpoint: "localhost:4318"

exporters:
  logging:
  otlp:

service:
  pipelines:
    logs: 
      receivers: [otlp]
      exporters: [logging, otlp]
import logging

def lambda_handler(event, context):
    print("Test print")

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    logger.info("Test info")
    logger.error("Test error")
@ok512 ok512 added the enhancement New feature or request label Jun 23, 2023
Copy link

This issue was marked stale. It will be closed in 30 days without additional activity.

@github-actions github-actions bot added the Stale label Jul 21, 2024
@gshpychka
Copy link
Contributor

Still relevant

@tylerbenson tylerbenson removed the Stale label Jul 22, 2024
@serkan-ozal
Copy link
Contributor

Hi @ok512, Auto instrumentation of the logs are not enabled by default as far as I know. So I think, you should enable it explicitly by setting OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED env var to true: https://opentelemetry.io/docs/zero-code/python/configuration/#logging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants