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 Distribution
File details
Details for the file elasticsearch-logger-0.0.1.tar.gz
.
File metadata
- Download URL: elasticsearch-logger-0.0.1.tar.gz
- Upload date:
- Size: 3.8 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 | 2304a199e2906e031bf428a4c5d0f675a7de5573988056e0029cba8fe43be0e3 |
|
MD5 | 62872c8470c2cc0e22be70ae19fd0bcd |
|
BLAKE2b-256 | 982f34552bc8fc03bc5febdda391c05a0105a22ccdb531e18bf3fd7e2a58a8ab |
File details
Details for the file elasticsearch_logger-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: elasticsearch_logger-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 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 | 4dda334baea187dab808ddd0c0ace56f83f12ad2c5df8ceefaf266bac9a6cdd8 |
|
MD5 | f825da0227455f1d8c883ed27052e9f8 |
|
BLAKE2b-256 | b637a810926f00f0de1d84251f0ce57f16a348be5587e33f11ad2c977fbe3473 |