Skip to main content

OpenObserve library

Project description

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'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openobserve-1.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

openobserve-1.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file openobserve-1.0.2.tar.gz.

File metadata

  • Download URL: openobserve-1.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for openobserve-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b12ced89b214fcf12bd4dda49deaa941cfded1330051cd7a86faffad21b35f27
MD5 78d444e9ca4f21dc0cf5fcbe90112ac7
BLAKE2b-256 1bcecb9c1966fe5d6d34e2c2af4753178868abdae72e4f531df2301bb1ba25e3

See more details on using hashes here.

File details

Details for the file openobserve-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: openobserve-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for openobserve-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d487c976d0fbd76fb102d7d2bbf819e1ae0df83b2617c9fa1ea344d098643578
MD5 9bc95db8d4dd8dc32870e838f242bfea
BLAKE2b-256 f045a6cc7acb08134c686851d9002c189ed883ff9e9aae8ab3016eeb956e9a42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page