Skip to main content

A logger using Elasticsearch in the background with a focus on simplicity.

Project description

Simple python pip package to log to elasticsearch. The main focus of this package is simplicity, such that errorlogging becomes super easy and needs only to be set up once.

Install

Hosted on PyPi now: https://pypi.org/project/simpleelasticlogging/

So just simply run `pip install simpleelasticlogging´

Bleeding Edge version:

`pip install git+https://github.com/JustinGuese/pip-simple-elasticsearch-logging´

Usage

from simpleelasticlogging import ElasticLogger
el = Elasticlogger()

def boundToFail():
    array = [2, 6, "tendies"]
    for elem in array:
        try:
            elem = elem / 2
        except Exception as e:
            msg = {
                "error" : repr(e),
                "elementWhereItHappened": elem,
                "otherNotes": "boundToFail Function"
            }
            el.log(msg)
            # raise

boundToFail()

Elasticsearch connection

The connection supports host, port, user and password for elastic.

The default values are - which can be changed:

  • host="localhost"
  • port=9200
  • es_user = None
  • es_pass = None
  • appname = "app"
  • errorindexname = "errors"

es_user and es_pass only need to be passed if xpack security in Elasticsearch is enabled, together with the Elasticsearch user.

Description

The good thing with a NoSql database is, that you can basically submit anything you want to the log() function as it takes everything.

I created this even though other packages exist to make it even simpler to log to elastic, and to support username and password with Elasticsearch.

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

simpleelasticlogging-0.1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

simpleelasticlogging-0.1.1-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file simpleelasticlogging-0.1.1.tar.gz.

File metadata

  • Download URL: simpleelasticlogging-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for simpleelasticlogging-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5402e5699766151f6dc8b4540aff98de8be2095174f72f9c7af05bd45478daa0
MD5 39d7ebff373db64d5f9b577979dc8d53
BLAKE2b-256 c413cd6cf86b18551948667a150a9bbc9ba278669ab8eb6986e26d49afa18644

See more details on using hashes here.

File details

Details for the file simpleelasticlogging-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: simpleelasticlogging-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for simpleelasticlogging-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 097e5e937425d16dc558b01732acc981d349d46ec1a656d45e2821e8220af045
MD5 6ed3f533f914baf934035c056b2ec316
BLAKE2b-256 61d7e1e068f7445b763091c4f2b4fa678d109b746ffa6c554be32bc385a83753

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