{ "info": { "author": "Enrico Tr\u00f6ger", "author_email": "enrico.troeger@uvena.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Logging" ], "description": "PyLogBeat\n=========\n\n[![Travis CI](https://travis-ci.org/eht16/pylogbeat.svg?branch=master)](https://travis-ci.org/eht16/pylogbeat)\n[![PyPI](https://img.shields.io/pypi/v/pylogbeat.svg)](https://pypi.org/project/pylogbeat/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pylogbeat.svg)](https://pypi.org/project/pylogbeat/)\n[![License](https://img.shields.io/pypi/l/pylogbeat.svg)](https://pypi.org/project/pylogbeat/)\n\nPyLogBeat is a simple, incomplete implementation of the Beats protocol\nused by Elastic Beats and Logstash. For more information about Beats see\nhttps://www.elastic.co/products/beats and\nhttps://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html.\n\nWith this library it is possible to send log messages or any data to\nLogstash' beats input plugin or any other service which implements\nthe Beats protocol.\n\nThe main difference to other transport mechanismens like direct TCP\nor UDP transfer is that with the Beats protocol there is a higher\nreliability of the data transfer, especially since the server\nacknowledges the data it received so the client knows whether and\nwhat to resend.\n\n\nInstallation\n------------\n\nThe easiest method is to install directly from pypi using pip:\n\n pip install pylogbeat\n\n\nIf you prefer, you can download PyLogBeat from\nhttps://github.com/eht16/pylogbeat and install it directly from source:\n\n python setup.py install\n\n\nGet the Source\n--------------\n\nThe source code is available at https://github.com/eht16/pylogbeat/.\n\n\nUsage\n-----\n\n### Simple use\n\n```python\n message = {'@timestamp': '2018-01-02T01:02:03', '@version': '1', 'message': 'hello world'}\n client = PyLogBeatClient('localhost', 5959, ssl_enable=False)\n client.connect()\n client.send(message)\n client.close()\n```\n\n### Using a context manager\n\n```python\n with PyLogBeatClient('localhost', 5959, ssl_enable=False) as client:\n client.send(message)\n```\n\n### Using a SSL connection\n\n```python\n with PyLogBeatClient('localhost', 5959, ssl_enable=True, ssl_verify=True,\n keyfile='certificate.key', certfile='certificate.crt', ca_certs='ca.crt') as client:\n client.send(message)\n```\n\nFor details regarding the SSL certificates and how to configure the\nLogstash input for SSL, see\nhttps://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html.\n\n\nMessage Format\n--------------\n\n`PyLogBeatClient.send()` accepts a sequence of \"messages\".\nThe messages can either be `dict` object representing the final\nmessage to be sent to Logstash or a `string` which must contain\nproperly formatted `JSON`.\nIf a `dict` is passed as element, it is converted to `JSON` using\n`json.dumps()`.\n\n### Example message\n\nThe following example is a message as `JSON`:\n\n```python\n {\n \"@timestamp\": \"2018-01-02T01:02:03\",\n \"@version\": \"1\",\n \"extra\": {\n \"application\": \"django_example\",\n \"django_version\": \"2.1.0\",\n \"environment\": \"production\"\n },\n \"host\": \"my-local-host\",\n \"level\": \"INFO\",\n \"logsource\": \"my-local-host\",\n \"message\": \"foo bar\",\n \"pid\": 65534,\n \"program\": \"example.py\",\n \"type\": \"python-logstash\"\n }\n```\n\nThis is the standard Logstash message format in JSON.\n\n\nLogging\n-------\n\nPyLogBeat uses a logger named \"pylogbeat\" to log some debug messages\nand warnings in case of errors. By default, the logger's log level\nis set to `Warning` so you will not see any debug log messages.\nIf necessary simply change the log level of the logger to see the debug\nmessages. For example:\n\n```python\n import logging\n logging.getLogger('pylogbeat').setLevel(logging.DEBUG)\n```\n\nIt is important to make this change *after* you imported\nthe `pylogbeat` module.\n\nFurthermore, PyLogBeatClient's constructor method takes a `use_logging`\nargument which should be a boolean indicating whether the logging\nsubsystem should be used at all. The argument defaults to `False`,\ni.e. if you want any logging, you need to pass `True`.\nIf PyLogBeat is used itself as part of the logging system (e.g.\nas the transport of a handler), it is important to not emit any new\nlog messages once the logging subsystem has been shutdown or is in the\nprocess of shutting down. In this case, `use_logging` must be `False`\nin order to suppress generating log messages.\n\n\nProtocol Support\n----------------\n\nThe implemented Beats protocol is not yet officially specified and\ndocumented, unfortunately. Hopefully the Beats developers will\nprovide a specification in the future.\nSo far, sending the data and waiting for the ACK from the server is\nimplemented. But there might some details from the protocol missing\nin the implementation.\n\n\nFuture Maintenance\n------------------\n\nIf you are interested in the code, want to improve it and/or\ncomplete the protocol support, please feel free to send PRs.\nI would be happy if someone likes to continue developing this library\nand would also take full maintainership for future development and\nreleases.\n\n\nContributing\n------------\n\nFound a bug or got a feature request? Please report it at\nhttps://github.com/eht16/pylogbeat/issues.\n\n\nCredits\n-------\n\nThis code is based on https://github.com/brxie/PyLumberjack and\nadopted to support version 2 of the protocol.\nThanks to brxie for the initial code.\n\n\nChangeLog\n---------\n\n### 1.0.2 / 2018-12-31\n\n- Add badges to README\n\n\n### 1.0.1 / 2018-12-31\n\n- Fix typo in setup.py\n- Use distribution \"trusty\" for Travis builds\n\n\n### 1.0.0 / 2018-12-31\n\n- Initial release\n\n\nLicense\n-------\nPyLogBeat is licensed under the Apache License 2.0.\n\n\nAuthor\n------\n\nEnrico Tr\u00f6ger \n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/eht16/pylogbeat/", "keywords": "logging logstash beats", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "pylogbeat", "package_url": "https://pypi.org/project/pylogbeat/", "platform": "", "project_url": "https://pypi.org/project/pylogbeat/", "project_urls": { "Homepage": "https://github.com/eht16/pylogbeat/", "Source code": "https://github.com/eht16/pylogbeat/", "Travis CI": "https://travis-ci.org/eht16/pylogbeat/" }, "release_url": "https://pypi.org/project/pylogbeat/1.0.2/", "requires_dist": [ "six" ], "requires_python": "", "summary": "Simple, incomplete implementation of the Beats protocol used by Elastic Beats and Logstash.", "version": "1.0.2" }, "last_serial": 4648250, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "bbbc9c1ebc87f24e67e1b7cba3092424", "sha256": "8a83d3e7443ca4e4dfbb0840328c54cecf162936ba857071a855b37bda165d3d" }, "downloads": -1, "filename": "pylogbeat-1.0.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "bbbc9c1ebc87f24e67e1b7cba3092424", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10145, "upload_time": "2018-12-31T13:41:28", "url": "https://files.pythonhosted.org/packages/0b/9c/d6f228db8861a0c823e62d2c9f0ce6b2cabd7f6f5f132c6e1111710fdbad/pylogbeat-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "79e03363ad37125133175366cc54a21e", "sha256": "df95ad2dc61da4cf04fafd06cd9007a2c464a929b4a5a7d68343dd237ea5c6ef" }, "downloads": -1, "filename": "pylogbeat-1.0.0.tar.gz", "has_sig": true, "md5_digest": "79e03363ad37125133175366cc54a21e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12558, "upload_time": "2018-12-31T13:41:31", "url": "https://files.pythonhosted.org/packages/ae/59/393101cd354b231026b2b09bb00f5c335dd582f48cc4bd604c54a2205b57/pylogbeat-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "206a8ed5d8d1ff003796a6960ef2b335", "sha256": "d9e8fd83b2b0e5bfed8d52d062c6d8dd852d92fde42e6a8693746f246098e376" }, "downloads": -1, "filename": "pylogbeat-1.0.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "206a8ed5d8d1ff003796a6960ef2b335", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10184, "upload_time": "2018-12-31T14:20:02", "url": "https://files.pythonhosted.org/packages/35/ee/546fb3a9cb548a7f675de3fa4d27db447782e0ae03139ba3612392a6582d/pylogbeat-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "adc0ab926bb02734f7d87d95f412cccc", "sha256": "1945c49a156e8b6d1f958bf7e05d17e921dc7769ec815aacbef5d4627abf67ad" }, "downloads": -1, "filename": "pylogbeat-1.0.1.tar.gz", "has_sig": true, "md5_digest": "adc0ab926bb02734f7d87d95f412cccc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12650, "upload_time": "2018-12-31T14:20:04", "url": "https://files.pythonhosted.org/packages/9e/6b/4c5b209640fb1a4239bb627c7139af22466a8fc690e1c5fa2f58b32591cd/pylogbeat-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "f8f5c0432fac232be3763b75761efb03", "sha256": "473494a0c798a560a8312ee662b333888181cf4db18cd8f87a8d7d1548beefd9" }, "downloads": -1, "filename": "pylogbeat-1.0.2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "f8f5c0432fac232be3763b75761efb03", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10262, "upload_time": "2018-12-31T14:56:49", "url": "https://files.pythonhosted.org/packages/b3/d1/e84e855ee945517d5d1e88c6464ab69b635fa37a0ccee3a2ace0a9a3d193/pylogbeat-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f97237275c8860c37cc907ed5b34ffac", "sha256": "11f3b1d04424151d406d8b844a8db6299442b4af1f10d5f622a6febf1ad5c41d" }, "downloads": -1, "filename": "pylogbeat-1.0.2.tar.gz", "has_sig": true, "md5_digest": "f97237275c8860c37cc907ed5b34ffac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12802, "upload_time": "2018-12-31T14:56:51", "url": "https://files.pythonhosted.org/packages/a8/0c/dc211ef63bb7e9bb06a99b569ace8da37dee8564f080e33ff1904c4477d8/pylogbeat-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f8f5c0432fac232be3763b75761efb03", "sha256": "473494a0c798a560a8312ee662b333888181cf4db18cd8f87a8d7d1548beefd9" }, "downloads": -1, "filename": "pylogbeat-1.0.2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "f8f5c0432fac232be3763b75761efb03", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10262, "upload_time": "2018-12-31T14:56:49", "url": "https://files.pythonhosted.org/packages/b3/d1/e84e855ee945517d5d1e88c6464ab69b635fa37a0ccee3a2ace0a9a3d193/pylogbeat-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f97237275c8860c37cc907ed5b34ffac", "sha256": "11f3b1d04424151d406d8b844a8db6299442b4af1f10d5f622a6febf1ad5c41d" }, "downloads": -1, "filename": "pylogbeat-1.0.2.tar.gz", "has_sig": true, "md5_digest": "f97237275c8860c37cc907ed5b34ffac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12802, "upload_time": "2018-12-31T14:56:51", "url": "https://files.pythonhosted.org/packages/a8/0c/dc211ef63bb7e9bb06a99b569ace8da37dee8564f080e33ff1904c4477d8/pylogbeat-1.0.2.tar.gz" } ] }