Skip to main content

django otlp log exporter (handler)

Collecting Logs using OpenTelemetry

OpenTelemetry provides various receivers and processors for collecting first-party and third-party logs directly via OpenTelemetry Collector or via existing agents such as FluentBit so that minimal changes are required to move to OpenTelemetry for logs.

Collecting legacy first-party Application Logs

There are two ways to collect logs from these applications.

Via File or Stdout Logs

Here, the logs of the application are directly collected by the OpenTelemetry receiver using collectors like filelog receiver and operators and processors to parse them into the OTel model.

Direct to collector ( our handler is implemented based on this approach )

In this approach you can modify your logging library that is used by the application to use the logging SDK provided by OpenTelemetry and directly forward the logs from the application to OpenTelemetry. This approach removes any need for agents/intermediary medium but loses the simplicity of having the log file locally.

https://github.com/mojtabaakbari221b/django_otlp_log_exporter/blob/main/direct_to_collector.png

Our Approach

You can directly send your application logs to your opentelementry collector with our log handler (which is finally delivered to backends like signoz.)

Installation

pip install django-otlp-log-exporter

Configuration (settings.py)

OTLP_ENDPOINT = env('OTLP_ENDPOINT') # its endpoint of your opentelementry collector listen on, defult= http://localhost:4317
OTLP_IS_SECURE = env('OTLP_IS_SECURE') # its bool, default= True
OTLP_TAG = env('OTLP_TAG') # for seprate logs, default= localhost debug
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'directlogging': {
            'level': 'WARNING',
            'class': 'otlp_exporter.handler.DirectWriteLoggingHandler',
        },
    },
    'loggers': {
        'root': {
            'handlers': [
                'directlogging',
            ],
            'level': 'WARNING',
            'propagate': True,
        },
    },
}

Much of our documentation is based on signoz.io's descriptions.

Thanks for the inspirations of other packages written, especially https://github.com/jayfk/django-fluentd . If you find a bug or have a question, you can contact me via the link below mojtaba.akbari.221B@gmail.com.

Metadata

Release files for django-otlp-log-exporter 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-otlp-log-exporter 1.0.3
File Size Uploaded Provenance Actions
django-otlp-log-exporter-1.0.3.tar.gz 3.3 kB Without provenance Details for django-otlp-log-exporter-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-otlp-log-exporter 1.0.3
File Interpreter ABI Platform Actions
django_otlp_log_exporter-1.0.3-py3-none-any.whl Python 3 none any Details for django_otlp_log_exporter-1.0.3-py3-none-any.whl

Total release size: 6.9 kB

Release files / django-otlp-log-exporter-1.0.3.tar.gz

Download URL django-otlp-log-exporter-1.0.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6e6473e21c36898c6d74e3b7d1c5b69461044a5a79331350b416cda7a746eb84
BLAKE2b-256 checksum
How to use checksums
fb7b7928996ad487644c416183ffbc3cad30ae20764b08f6713bcdc7099ca442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / django_otlp_log_exporter-1.0.3-py3-none-any.whl

Download URL django_otlp_log_exporter-1.0.3-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c85de7aa082b78fd491dfb50ef6e5333c86f16c21926119584516fca45a08439
BLAKE2b-256 checksum
How to use checksums
a60f63fd5eed8018c50589f2d5a3f28732dd5d64064b9440169aed3e3532891a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for django-otlp-log-exporter 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page