Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skelmis/logoo
A Python package for easy openobserve log ingestion
https://github.com/skelmis/logoo
Last synced: 3 months ago
JSON representation
A Python package for easy openobserve log ingestion
- Host: GitHub
- URL: https://github.com/skelmis/logoo
- Owner: Skelmis
- License: mit
- Created: 2024-03-02T14:47:34.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-06-13T09:40:15.000Z (8 months ago)
- Last Synced: 2024-09-19T12:48:42.434Z (4 months ago)
- Language: Python
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
## Logoo
#### A log ingestion engine for [openobserve](https://github.com/openobserve/openobserve)*Pronounced log-ew*
`pip install logoo`
### Examples
Primary file. One instance of `PrimaryLogger` is required per program.
```python
import asynciofrom logoo import PrimaryLogger
async def main():
logger: PrimaryLogger = PrimaryLogger(
__name__,
base_url="",
org="",
stream="",
username="",
password="",
poll_time=5,
)
await logger.start_consumer()logger.info("Hello world!")
logger.critical("Something went wrong!")
await asyncio.sleep(10)asyncio.run(main())
```Any other file:
```python
from logoo import Loggerlogger = Logger(__name__)
logger.info("This comes from another file.")
```Note that this supports argument interpolation and can be a fairly good drop in logging replacement:
```python
from logging import Logger as built_in_logger
from logoo import Loggerlog = built_in_logger(__name__)
logger = Logger(__name__)log.info("%s", "Test")
logger.info("%s", "test")
```Documentation is as follows and remarkably simple:
```text
Parameters
----------
name: str
The name of the logger
base_url: str
Your base openobserve URL.E.g. `base_url="https://logs.example.com"`
org: str
The org to make logs under
stream: str
The stream for these logs to be ingested under
username: str
The username to use for auth
password: str
The password to use for auth
logs_per_call: int
How many logs to send per request to your instance.
Useful to set, so you don't hit things like WAF request
limits in high throughput environments.
Note logoo makes as many requests as required
to exhaust the queue every `poll_time`.Defaults to `100`.
poll_time: datetime.timedelta | float
How often to send all logs to your instance.Defaults to every `30` seconds.
extra_metadata: dict
Extra metadata to add to all logs made by this class
global_metadata: dict
Extra metadata to add to every log sent to your instance
```---
### Support
Want realtime help? Join the discord [here](https://discord.gg/BqPNSH2jPg).
---
### License
This project is licensed under the MIT license