Python Client for Yandex Cloud Logging
Installation
pip3 install python-yandex-cloud-logging
Creating a Yandex Cloud Logging Group
yc logging group create --name=group --retention-period=1h
Result
done (1s)
id: af3flf29t8**********
folder_id: aoek6qrs8t**********
cloud_id: aoegtvhtp8**********
created_at: "2021-06-24T09:56:38.970Z"
name: group
status: ACTIVE
retention_period: 3600s
https://cloud.yandex.com/en/docs/logging/quickstart
Credentials
There are several options for authorization your requests - OAuth Token, Metadata Service (if you're executing code inside VMs or Functions running in Yandex.Cloud) and Service Account Keys
OAuth Token
yc config get token
Result
AQA....
from pyclm.logging import Logger
log = Logger(
log_group_id="....",
credentials={"token": "AQA...."}
)
Service Account Keys
from pyclm.logging import Logger
log = Logger(
log_group_id="....",
credentials={
"service_account_key": {
"service_account_id": "....",
"id": "....",
"private_key": "<PEM>"
}
}
)
Use Yandex SDK
sdk = yandexcloud.SDK(...)
log = Logger(
sdk=sdk, log_group_id="....",
resource_type="....", resource_id="....",
elements=100, period=10, workers=1
)
resource_type - Resource type, serverless.function, hostname. Value must match the regular expression ([a-zA-Z][-a-zA-Z0-9_.]{0,63})?.
resource_id - Resource ID, i.e., ID of the function producing logs. Value must match the regular expression ([a-zA-Z0-9][-a-zA-Z0-9_.]{0,63})?.
elements - The number of elements before writing, must be in the range 1-100.
period - Number of seconds to wait for new log entries before writing.
workers - Number of process ingestion.
Metadata
Release files for python-yandex-cloud-logging 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-yandex-cloud-logging-0.1.0.tar.gz | 18.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_yandex_cloud_logging-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.5 kB
Release files / python-yandex-cloud-logging-0.1.0.tar.gz
| Download URL | python-yandex-cloud-logging-0.1.0.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3db891a7ce5d8dc66aed07daf736cd9b9984dda30cfc893063d427cddccefcf
|
|
BLAKE2b-256 checksum How to use checksums |
14a3a8ff733271af446fa42cc7bb49546bcd92c7c7572f7e34b2764b935a862b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Release files / python_yandex_cloud_logging-0.1.0-py3-none-any.whl
| Download URL | python_yandex_cloud_logging-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b84cf6651282271f5af7123bde2619097ce279458d49990a52838197c6affc08
|
|
BLAKE2b-256 checksum How to use checksums |
b921354da3e11e38a7a60082a08ca8e21abd0e93dae2bd690a2e8705b84dc403
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|