Library for logging to Elastic Search.
Project description
elasticsearch-logger
Simple package for logging to Elasticsearch. Expected usage is to use this package inside your k8s cluster.
Installation
pip install elasticsearch_logger
Example of usage
In this example we write 3 messages (1-3) to buffer and after that write to Elasticsearch running on address 127.0.0. :9200 one-by-one (that should be changed to bulk write). Logger has 4 levels of severity (DEBUG, INFO, WARNING, ERROR) and writes messages in the following format: appName:default-app-name appName.keyword:default-app-name env:default-env-name env.keyword:default-env-name payload:Hi 3 severity:INFO severity.keyword:INFO timestamp:Jun 30, 2021 @ 18:46:54.620 _index:app-name-logs-default-app-name-30-06-2021 _score: - _type:doc
.
from elasticsearch_logger import ElasticLogger
mh_logger = ElasticLogger(
buffer_size=3,
index='app-name-logs',
app_name='app_name',
env='dev',
port=9200,
ip_addr='127.0.0.1'
)
mh_logger.info('Hi! 1')
mh_logger.info('Hi! 2')
mh_logger.info('Hi! 3')
mh_logger.info('Hi! 4')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file elasticsearch-logger-0.0.2.tar.gz
.
File metadata
- Download URL: elasticsearch-logger-0.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87214eb5b42a402da6b40dfbfffe1d814abaa4e38c07f5d3fd25ea51179972fd |
|
MD5 | bfbfdf1def3226f8cbc5ca57ab53d85e |
|
BLAKE2b-256 | 3fbd0b8e4e8c014d8dd87e3628aa84b21e9b69207160eeebbd407fde46151a94 |
File details
Details for the file elasticsearch_logger-0.0.2-py3.8.egg
.
File metadata
- Download URL: elasticsearch_logger-0.0.2-py3.8.egg
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c63ecd3803737b0c0ee7411ad5a9bf4c7a171c410bc8635abc442b1d1bbd8db |
|
MD5 | 495130ffbc9d520f5182098ddbdeffeb |
|
BLAKE2b-256 | 802e2527c7d74f8427f7db1fcec0376f887bad8302b66a1e4b79ef5fe6880cee |
File details
Details for the file elasticsearch_logger-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: elasticsearch_logger-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68f34d35b39f5bef0fa9228ba8fe52780ff8fac8e628d89cc83f19032ef4527e |
|
MD5 | f9591767395e9d6b2ec4eef17c393a01 |
|
BLAKE2b-256 | ed365577d7e6f3e80a98c2c8377771e01a1c79aac24ddae1134d457dafc7bb00 |