Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elasticsearch-logger-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distributions

elasticsearch_logger-0.0.2-py3.8.egg (3.4 kB view details)

Uploaded Source

elasticsearch_logger-0.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

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

Hashes for elasticsearch-logger-0.0.2.tar.gz
Algorithm Hash digest
SHA256 87214eb5b42a402da6b40dfbfffe1d814abaa4e38c07f5d3fd25ea51179972fd
MD5 bfbfdf1def3226f8cbc5ca57ab53d85e
BLAKE2b-256 3fbd0b8e4e8c014d8dd87e3628aa84b21e9b69207160eeebbd407fde46151a94

See more details on using hashes here.

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

Hashes for elasticsearch_logger-0.0.2-py3.8.egg
Algorithm Hash digest
SHA256 3c63ecd3803737b0c0ee7411ad5a9bf4c7a171c410bc8635abc442b1d1bbd8db
MD5 495130ffbc9d520f5182098ddbdeffeb
BLAKE2b-256 802e2527c7d74f8427f7db1fcec0376f887bad8302b66a1e4b79ef5fe6880cee

See more details on using hashes here.

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

Hashes for elasticsearch_logger-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 68f34d35b39f5bef0fa9228ba8fe52780ff8fac8e628d89cc83f19032ef4527e
MD5 f9591767395e9d6b2ec4eef17c393a01
BLAKE2b-256 ed365577d7e6f3e80a98c2c8377771e01a1c79aac24ddae1134d457dafc7bb00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page