Skip to main content

python-openobserve

Actions Status - Main PyPI Downloads

Documentation build status OpenSSF Scorecard

A python connector to interact with OpenObserve (https://github.com/openobserve/openobserve) be it sending data, searching, or exporting/importing settings.

The idea is to have a similar python connector to the "Elasticsearch" package, which allows a 1:1 replacement of the "Elasticsearch" package with the "OpenObserve" package.

OpenObserve is way more lightweight than Elasticsearch, and it is open source, like everything should be.

install

pip install python-openobserve

usage

see example.ipynb for a full example

from python_openobserve.openobserve import OpenObserve

OO = OpenObserve(user = "root@example.com", password = "Complexpass#123")

from datetime import datetime
from random import random
from pprint import pprint
document = {
    "@timestamp" : datetime.utcnow(),
    "component" : "testagent",
    "action" : "buy",
    "amount" : random() * 100,
    "portfolio" : {
        "USD" : random() * 100.0,
        "BTC" : 0.1 + random() * 0.1
    }
}
pprint(document)

# insert document
OO.index("dd", document)

#search
# example sql parsing helper
sql = 'SELECT * FROM "dd"'
results = OO.search(sql, days=1)
print(f"got {len(results)} results")
pprint(results)

OO = OpenObserve(host="https://o2.example.com", user="root@example.com", password="Complexpass#123")
sql = 'SELECT log_file_name,count(*) FROM "default" GROUP BY log_file_name'
start_timeperiod = datetime.now() - timedelta(days=7)
end_timeperiod = datetime.now()
df_search_results = oo_conn.search2df(
    sql,
    start_time=start_timeperiod,
    end_time=end_timeperiod,
    verbosity=5,
)

# Export settings in split json, csv, or xlsx
OO.config_export(f"{tmpdir}/", verbosity=0, split=True)
OO.config_export(f"{tmpdir}/", verbosity=0, outformat="csv")
OO.config_export(f"{tmpdir}/", verbosity=0, outformat="xlsx")

Troubleshooting

If you have issues, try:

  • increase verbosity
  • reproduce issue with curl directly
  • check known issues

Known issues

There are notable gaps and inconsistence in openobserve API at Q2 2025. Check against documentation and swagger. Report API issues upstream.

  • folder_id in alerts creation is ignored
  • API field names are variable (id, alert_id)
  • API returns are inconsistent (use folderId at alert creation but get folder name at alert listing)

Download files

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

Source Distribution

python_openobserve-0.5.2.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_openobserve-0.5.2-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file python_openobserve-0.5.2.tar.gz.

File metadata

  • Download URL: python_openobserve-0.5.2.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for python_openobserve-0.5.2.tar.gz
Algorithm Hash digest
SHA256 9f9396180649bbf0589b9161d0c2aabacad179aa1ba007e87c7f769551ff27d7
MD5 21282401476a2aeda07943fe7581b98a
BLAKE2b-256 1d55dde4a1e357063d6a9f5d356ebf0cb1092d71ae06361749ca4e9bb1ce05c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_openobserve-0.5.2.tar.gz:

Publisher: python-publish.yml on JustinGuese/python-openobserve

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_openobserve-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_openobserve-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f383b56c251949b0ae208bdf9f89fd488d51189ac5d2aa14bdfdd789b5524921
MD5 c25da6e087556add1ea8d6e06708b030
BLAKE2b-256 876453105d6e37325858868d8fd6fe48b08da2bb262e0e42fd331d84588572dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_openobserve-0.5.2-py3-none-any.whl:

Publisher: python-publish.yml on JustinGuese/python-openobserve

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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