Skip to main content

OpenObserve

A library for sending logs to OpenObserve

Logi

Logs for library errors and for global_exception_logger are located at:

cd /home/$USER/.openobserve/logs/log.log

Configuration

import openobserve
openobserve.username = ''
openobserve.password = ''
openobserve.host = 'http://127.0.0.1:5080',
openobserve.stream_global = 'default' #default stream
openobserve.organization_global = 'default' #default organization
openobserve.ssl_verify = False #SSL host verification
openobserve.additional_info = False #additional data
openobserve.enable_threading = True #enable send logs in thread (speed up)

Sending a log

Fields _stream and _organization override stream_global and organization_global

def send(
    job: Any = '',
    level: str = 'INFO',
    _stream: str = None,
    _organization: str = None,
    **kwargs
)

Example

import openobserve
openobserve.send(job='test', _return_data=True,message='test message')

Log:

{
    '_timestamp': '2024-03-25T20:10:47.106', 
    'level': 'INFO',
    'job': 'test', 
    'message': 'test message'
}

Additional data for openobserve.additionalinfo

{
    'hostname': socket.gethostname(),
    'user_name': socket.gethostname(),
    'system': platform.system(),
    'system_architecture': platform.machine(),
    'system_version': platform.version(),
    'system_release': platform.release(),
    'python_version': platform.python_version()
}

Global error collection

Code for globally collecting errors from the project

import openobserve.global_exception_logger

print(1 / 0)

At this point, the log is sent to the server and saved on disk

Configuration

import openobserve.global_exception_logger

openobserve.global_exception_logger.organization_global = 'default'
openobserve.global_exception_logger.stream_global = 'default'

Metadata

Release files for openobserve 1.0.2

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

Source distribution (sdist)

Source distribution for openobserve 1.0.2
File Size Uploaded
openobserve-1.0.2.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openobserve 1.0.2
File Interpreter ABI Platform
openobserve-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / openobserve-1.0.2.tar.gz

Download URL openobserve-1.0.2.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b12ced89b214fcf12bd4dda49deaa941cfded1330051cd7a86faffad21b35f27
BLAKE2b-256 checksum
How to use checksums
1bcecb9c1966fe5d6d34e2c2af4753178868abdae72e4f531df2301bb1ba25e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / openobserve-1.0.2-py3-none-any.whl

Download URL openobserve-1.0.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d487c976d0fbd76fb102d7d2bbf819e1ae0df83b2617c9fa1ea344d098643578
BLAKE2b-256 checksum
How to use checksums
f045a6cc7acb08134c686851d9002c189ed883ff9e9aae8ab3016eeb956e9a42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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