No project description provided
Project description
python-openobserve
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)
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
Built Distribution
File details
Details for the file python_openobserve-0.3.0.tar.gz
.
File metadata
- Download URL: python_openobserve-0.3.0.tar.gz
- Upload date:
- Size: 30.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b193c43de568be287ac94124c05ec6dbbfde35c413f2c6664bd55ce41f74bff8
|
|
MD5 |
c6f58d5f1db3ad0adfb1934380f4e585
|
|
BLAKE2b-256 |
8702fc7c6b7209d8e49665178ffa0b1841ebd78f6b5679e873bfed3249d4fd0a
|
Provenance
The following attestation bundles were made for python_openobserve-0.3.0.tar.gz
:
Publisher:
python-publish.yml
on JustinGuese/python-openobserve
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
python_openobserve-0.3.0.tar.gz
-
Subject digest:
b193c43de568be287ac94124c05ec6dbbfde35c413f2c6664bd55ce41f74bff8
- Sigstore transparency entry: 264825932
- Sigstore integration time:
-
Permalink:
JustinGuese/python-openobserve@9557b45f64633629dbd45c935b47fe11d551a6cd
-
Branch / Tag:
refs/tags/0.3.0
- Owner: https://github.com/JustinGuese
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python-publish.yml@9557b45f64633629dbd45c935b47fe11d551a6cd
-
Trigger Event:
release
-
Statement type:
File details
Details for the file python_openobserve-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: python_openobserve-0.3.0-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7cf7db26ee0cbf68fe2a207b42030cecb7283de73a147487f3cdb6d62d27a260
|
|
MD5 |
4ad534207719c03ea3a1b008ed345c62
|
|
BLAKE2b-256 |
22ab6e38ab26d0f491800ad8d3eddcac02fd1441abe6dd4f7b3bdde58932bd3e
|
Provenance
The following attestation bundles were made for python_openobserve-0.3.0-py3-none-any.whl
:
Publisher:
python-publish.yml
on JustinGuese/python-openobserve
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
python_openobserve-0.3.0-py3-none-any.whl
-
Subject digest:
7cf7db26ee0cbf68fe2a207b42030cecb7283de73a147487f3cdb6d62d27a260
- Sigstore transparency entry: 264825935
- Sigstore integration time:
-
Permalink:
JustinGuese/python-openobserve@9557b45f64633629dbd45c935b47fe11d551a6cd
-
Branch / Tag:
refs/tags/0.3.0
- Owner: https://github.com/JustinGuese
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python-publish.yml@9557b45f64633629dbd45c935b47fe11d551a6cd
-
Trigger Event:
release
-
Statement type: