Collecting Application Logs Using OTEL Python SDK
You can directly send logs of your application to SigNoz using the Python SDKs provided by opentlemetry. Please find an example here.
The default logging level in Python is WARNING.
To send all the logs to SigNoz please change the default log level to DEBUG.
import logging
logging.basicConfig(level=logging.DEBUG)
For SigNoz Cloud
For sending logs to SigNoz cloud, while running the above example set the below environment variables
The value of
OTEL_EXPORTER_OTLP_ENDPOINT
environment variable will behttps://ingest.{region}.signoz.cloud:443
where depending on the choice of your region for SigNoz cloud, the otlp endpoint will vary according to this table.Region Endpoint US ingest.us.signoz.cloud:443 IN ingest.in.signoz.cloud:443 EU ingest.eu.signoz.cloud:443 The value of
OTEL_EXPORTER_OTLP_HEADERS
environment variable will besignoz-access-token=<SIGNOZ_INGESTION_KEY>
where<SIGNOZ_INGESTION_KEY>
is your ingestion keyYour run command will look like
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token=<SIGNOZ_INGESTION_KEY> python3 example.py`