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

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.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

openobserve-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openobserve-1.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for openobserve-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5a80920dff9444c69c8c3ecaf66fbfc67f48d0edb6b4244c04a88cbb553b7c28
MD5 146edca386f47b998c5ad4ca35f9ec8c
BLAKE2b-256 e8adec76168fd92dd6b2d969ab176bf81d18224acc45c7df61de2c9898d9de31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openobserve-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for openobserve-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab994b055f48648ec19466a9eaa2a7e2ff988a3166b5d675bb99c51dfa278ce8
MD5 9510c97676d0bef6a3ad876d5a204eb1
BLAKE2b-256 184e8708e4f5044968c4b35a0763e860b6b65f64c537fed6daca29f2cbfac32b

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