2022-09-20 21:58:41 +00:00
|
|
|
|
LDPy
|
|
|
|
|
====
|
|
|
|
|
|
2022-10-11 00:32:54 +00:00
|
|
|
|
This project moved to: [`git.afpy.org`](https://git.afpy.org/fcode/ldpy)
|
2022-09-20 21:58:41 +00:00
|
|
|
|
|
2022-10-11 00:32:54 +00:00
|
|
|
|
🚧 _work in progress, take a look on other branches if you are curious…_
|
2022-09-24 15:05:34 +00:00
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
An [OVH Log Data Platform](https://docs.ovh.com/fr/logs-data-platform/) python client.
|
|
|
|
|
|
|
|
|
|
[Log Data Platform](https://docs.ovh.com/fr/logs-data-platform/) is a log management platform based on [`opensearch`](https://opensearch.org/).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
💡 Idea
|
|
|
|
|
-------
|
|
|
|
|
|
|
|
|
|
1. Access LDP stream
|
|
|
|
|
1. Query the logs
|
|
|
|
|
1. Trigger actions
|
2022-09-20 21:58:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
🚀 Use quick-start
|
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
|
|
Get the source & edit settings:
|
|
|
|
|
```bash
|
2022-10-11 00:32:54 +00:00
|
|
|
|
git clone git@git.afpy.org:fcode/LDPy.git && cd ldpy
|
2022-09-20 21:58:41 +00:00
|
|
|
|
cp client.sample.py client.py
|
|
|
|
|
${EDITOR} client.py
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Set up environment & run help:
|
|
|
|
|
```bash
|
|
|
|
|
mkdir ~/.venvs && python3 -m venv ~/.venvs/ldpy
|
|
|
|
|
source ~/.venvs/ldpy/bin/activate
|
|
|
|
|
pip install -r requirements.txt
|
2022-09-25 22:33:09 +00:00
|
|
|
|
./ldpy.py -h
|
2022-09-20 21:58:41 +00:00
|
|
|
|
```
|
|
|
|
|
|
2022-09-25 22:33:09 +00:00
|
|
|
|
* Get stream mapping: `./ldpy.py --mapping`
|
2022-10-11 00:32:54 +00:00
|
|
|
|
* Get last `n` entries: `./ldpy.py --last`
|
2022-09-20 21:58:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
🚧 Devel quick-start
|
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
- Built with `Python 3.8`
|
2022-10-11 00:32:54 +00:00
|
|
|
|
- Code linting with [`flake8`](https://pypi.org/project/flake8/), [`pylint`](https://pypi.org/project/pylint), [`black`](https://pypi.org/project/black) & [`pydocstyle`](https://pypi.org/project/pydocstyle/).
|
2022-09-20 21:58:41 +00:00
|
|
|
|
- Install development tools:
|
|
|
|
|
* `pip install -r requirements-dev.txt`
|
|
|
|
|
- A `Makefile` with tools : run `make help` to have a look
|
|
|
|
|
- Use the `pre-commit` git hook
|
2022-09-25 20:24:43 +00:00
|
|
|
|
* `echo "make --no-print-directory --quiet lint" > .git/hooks/pre-commit`
|
2022-09-20 21:58:41 +00:00
|
|
|
|
* `chmod u+x .git/hooks/pre-commit`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 📌 Dependences
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details in [`requirements.txt`](requirements.txt) & [`requirements-dev.txt`](requirements-dev.txt)
|
|
|
|
|
|
|
|
|
|
- [`opensearch-py`](https://opensearch.org/docs/latest/clients/python/)
|
2022-09-29 13:54:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ℹ️ Talk about this project
|
|
|
|
|
|
|
|
|
|
- [**AFPy 2022/09**](https://www.meetup.com/fr-FR/python-afpy-lyon/events/287980312/): [`ftalk/ldpy!1`](https://gitlab.com/ftalk/ldpy/-/merge_requests/1)
|