{ "info": { "author": "Ivan Mukhin", "author_email": "muhin.ivan@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Logging" ], "description": "pygelf\n======\n|travis| |coveralls| |pypi|\n\n.. |travis| image:: https://travis-ci.org/keeprocking/pygelf.svg?branch=master\n :target: https://travis-ci.org/keeprocking/pygelf\n.. |pypi| image:: https://badge.fury.io/py/pygelf.svg\n :target: https://pypi.python.org/pypi/pygelf\n.. |coveralls| image:: https://coveralls.io/repos/github/keeprocking/pygelf/badge.svg?branch=master\n :target: https://coveralls.io/github/keeprocking/pygelf?branch=master\n\n\nPython logging handlers with GELF (Graylog Extended Log Format) support.\n\nCurrently TCP, UDP, TLS (encrypted TCP) and HTTP logging handlers are supported.\n\nGet pygelf\n==========\n.. code:: python\n\n pip install pygelf\n\nUsage\n=====\n\n.. code:: python\n\n from pygelf import GelfTcpHandler, GelfUdpHandler, GelfTlsHandler, GelfHttpHandler\n import logging\n\n\n logging.basicConfig(level=logging.INFO)\n logger = logging.getLogger()\n logger.addHandler(GelfTcpHandler(host='127.0.0.1', port=9401))\n logger.addHandler(GelfUdpHandler(host='127.0.0.1', port=9402))\n logger.addHandler(GelfTlsHandler(host='127.0.0.1', port=9403))\n logger.addHandler(GelfHttpHandler(host='127.0.0.1', port=9404))\n\n logger.info('hello gelf')\n\nMessage structure\n=================\n\nAccording to the GELF spec, each message has the following mandatory fields:\n\n- **version**: '1.1', can be overridden when creating a logger\n- **short_message**: the log message itself\n- **timestamp**: current timestamp\n- **level**: syslog-compliant_ log level number (e.g. WARNING will be sent as 4)\n- **host**: hostname of the machine that sent the message\n- **full_message**: this field contains stack trace and is being written **ONLY** when logging an exception, e.g.\n\n.. code:: python\n\n try:\n 1/0\n except ZeroDivisionError as e:\n logger.exception(e)\n\n.. _syslog-compliant: https://en.wikipedia.org/wiki/Syslog#Severity_level\n\nIn debug mode (when handler was created with debug=True option) each message contains some extra fields (which are pretty self-explanatory): \n\n- **_file**\n- **_line**\n- **_module**\n- **_func**\n- **_logger_name**\n\nConfiguration\n=============\n\nEach handler has the following parameters:\n\n- **host**: IP address of the GELF input\n- **port**: port of the GELF input\n- **debug** (False by default): if true, each log message will include debugging info: module name, file name, line number, method name\n- **version** ('1.1' by default): GELF protocol version, can be overridden\n- **include_extra_fields** (False by default): if true, each log message will include all the extra fields set to LogRecord\n- **json_default** (:code:`str` with exception for several :code:`datetime` objects): function that is called for objects that cannot be serialized to JSON natively by python. Default implementation is custom function that returns result of :code:`isoformat()` method for :code:`datetime.datetime`, :code:`datetime.time`, :code:`datetime.date` objects and result of :code:`str(obj)` call for other objects (which is string representation of an object with fallback to :code:`repr`)\n\nAlso, there are some handler-specific parameters.\n\nUDP:\n\n- **chunk\\_size** (1300 by default) - maximum length of the message. If log length exceeds this value, it splits into multiple chunks (see https://www.graylog.org/resources/gelf/ section \"chunked GELF\") with the length equals to this value. This parameter must be less than the MTU_. If the logs don't seem to be delivered, try to reduce this value.\n- **compress** (True by default) - if true, compress log messages before sending them to the server\n\n.. _MTU: https://en.wikipedia.org/wiki/Maximum_transmission_unit\n\nTLS:\n\n- **validate** (False by default) - if true, validate server certificate. If server provides a certificate that doesn't exist in **ca_certs**, you won't be able to send logs over TLS\n- **ca_certs** (None by default) - path to CA bundle file. This parameter is required if **validate** is true.\n- **certfile** (None by default) - path to certificate file that will be used to identify ourselves to the remote endpoint. This is necessary when the remote server has client authentication required. If **certfile** contains the private key, it should be placed before the certificate.\n- **keyfile** (None by default) - path to the private key. If the private key is stored in **certfile** this parameter can be None.\n\nHTTP:\n\n- **compress** (True by default) - if true, compress log messages before sending them to the server\n- **path** ('/gelf' by default) - path of the HTTP input (http://docs.graylog.org/en/latest/pages/sending_data.html#gelf-via-http)\n- **timeout** (5 by default) - amount of seconds that HTTP client should wait before it discards the request if the server doesn't respond\n\nStatic fields\n=============\n\nIf you need to include some static fields into your logs, simply pass them to the handler constructor. Each additional field should start with underscore. You can't add field '\\_id'.\n\nExample:\n\n.. code:: python\n\n handler = GelfUdpHandler(host='127.0.0.1', port=9402, _app_name='pygelf', _something=11)\n logger.addHandler(handler)\n\nDynamic fields\n==============\n\nIf you need to include some dynamic fields into your logs, add them to record by using LoggingAdapter or logging.Filter and create handler with include_extra_fields set to True.\nAll the non-trivial fields of the record will be sent to graylog2 with '\\_' added before the name\n\nExample:\n\n.. code:: python\n\n class ContextFilter(logging.Filter):\n\n def filter(self, record):\n record.job_id = threading.local().process_id\n return True\n\n logger.addFilter(ContextFilter())\n handler = GelfUdpHandler(host='127.0.0.1', port=9402, include_extra_fields=True)\n logger.addHandler(handler)\n\nRunning tests\n=============\n\nTo run tests, you'll need tox_. After installing, simply run it:\n\n.. code::\n\n tox\n\n.. _tox: https://pypi.python.org/pypi/tox", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/keeprocking/pygelf", "keywords": "logging udp tcp ssl tls graylog2 graylog gelf", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pygelf", "package_url": "https://pypi.org/project/pygelf/", "platform": "", "project_url": "https://pypi.org/project/pygelf/", "project_urls": { "Homepage": "https://github.com/keeprocking/pygelf" }, "release_url": "https://pypi.org/project/pygelf/0.3.6/", "requires_dist": null, "requires_python": "", "summary": "Logging handlers with GELF support", "version": "0.3.6" }, "last_serial": 5525151, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "49bd1143224ac93cc774b3d44990d867", "sha256": "494662d618915874bf2bae53ccf77adc7f950b612561bd1b75d3cdd8f0c69991" }, "downloads": -1, "filename": "pygelf-0.1.1.tar.gz", "has_sig": false, "md5_digest": "49bd1143224ac93cc774b3d44990d867", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3136, "upload_time": "2015-08-16T10:38:39", "url": "https://files.pythonhosted.org/packages/38/34/1c4c0a9ddbb51b54af15bb6be2e6b95ced6e95aa95324b342d0e5612f2fa/pygelf-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "562f227b2f7def37b56478df1017a2d3", "sha256": "1189d9a48a81dd57a2c9559e549cb4c85a11ac137b8b26db03fb1c8de8f5d8a8" }, "downloads": -1, "filename": "pygelf-0.2.0.tar.gz", "has_sig": false, "md5_digest": "562f227b2f7def37b56478df1017a2d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3839, "upload_time": "2015-09-03T20:18:32", "url": "https://files.pythonhosted.org/packages/42/5d/9e0f40c9b06fda6e3567bc6c404f417f524de31820240b6bb7551170a0a4/pygelf-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1de069d334fa377857ec3bca61bb17b3", "sha256": "3b2dbd9afef220e63201549ae2e272f07350f8d4d3c94ba16c7b339ef94c66d3" }, "downloads": -1, "filename": "pygelf-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1de069d334fa377857ec3bca61bb17b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3839, "upload_time": "2015-09-28T18:29:25", "url": "https://files.pythonhosted.org/packages/8b/e1/381abd539a4f2920e6a8f463d468d86691f22bdb0f8b1fb85ed4f1da4044/pygelf-0.2.1.tar.gz" } ], "0.2.10": [ { "comment_text": "", "digests": { "md5": "076621ac2f9315a9771d85328c69d491", "sha256": "5b107f622e3b7a761d9407c699a8c750960a14beda90624e4a0483bac293883b" }, "downloads": -1, "filename": "pygelf-0.2.10.tar.gz", "has_sig": false, "md5_digest": "076621ac2f9315a9771d85328c69d491", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8130, "upload_time": "2017-02-26T12:41:10", "url": "https://files.pythonhosted.org/packages/55/eb/2738c2d6556d6efe061792425215e43a97bea07c054b05e93c4d241386bb/pygelf-0.2.10.tar.gz" } ], "0.2.11": [ { "comment_text": "", "digests": { "md5": "14f3c257c57782eefe203def54352ccc", "sha256": "80e6474943768b7969d9d03e3f5466b49a9a84aec77882df9fa094465aea41ac" }, "downloads": -1, "filename": "pygelf-0.2.11.tar.gz", "has_sig": false, "md5_digest": "14f3c257c57782eefe203def54352ccc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8315, "upload_time": "2017-03-05T11:53:06", "url": "https://files.pythonhosted.org/packages/21/2f/ec8c5fcfc9672c4f848a27b9321fdf78af1d40655d0e0d1fcd56038fda03/pygelf-0.2.11.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "5980f2c918cc235b23ef720ad17a1f76", "sha256": "9520e247a0884968b279f2ff4ec1b36d9bf6de8a90679e55ab769fa052f338a4" }, "downloads": -1, "filename": "pygelf-0.2.2.tar.gz", "has_sig": false, "md5_digest": "5980f2c918cc235b23ef720ad17a1f76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3774, "upload_time": "2015-10-07T09:28:52", "url": "https://files.pythonhosted.org/packages/46/2c/a196fbcdfa67b98acd32a6eb6f9b0247f7b3e79f963117de6f0e21461234/pygelf-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "6de35016615d99f11ba74aeed14977ad", "sha256": "68c5a942cae6a8fe5076b6d25ef0187007470432acd120c398db77e8e53ae473" }, "downloads": -1, "filename": "pygelf-0.2.3.tar.gz", "has_sig": false, "md5_digest": "6de35016615d99f11ba74aeed14977ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3798, "upload_time": "2016-01-21T21:30:24", "url": "https://files.pythonhosted.org/packages/9d/70/06ebc3dc97f9d315f321eebfb6fc904c9b7b945ec1365624a2d66a10129c/pygelf-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "f4d2d7aa9a61ab44bd874f228baa24c4", "sha256": "ce2fa25f206aaab7e07f514c8d1e8b8b045e147067d3ae6bf13fd405897aae2a" }, "downloads": -1, "filename": "pygelf-0.2.4.tar.gz", "has_sig": false, "md5_digest": "f4d2d7aa9a61ab44bd874f228baa24c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4010, "upload_time": "2016-06-12T19:02:47", "url": "https://files.pythonhosted.org/packages/a6/eb/4fc9a6dfac2273ce3b52fb39a0c29417a691c2a8cda3ca9c887f2106e772/pygelf-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "8b010e4f7ffc069ef232ed64a9dfcc3f", "sha256": "442dc0577259e8d3db9c690debc7eb705e9e9facafd8322d47773cc776ffaf1e" }, "downloads": -1, "filename": "pygelf-0.2.5.tar.gz", "has_sig": false, "md5_digest": "8b010e4f7ffc069ef232ed64a9dfcc3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4728, "upload_time": "2016-08-09T22:23:06", "url": "https://files.pythonhosted.org/packages/23/c8/32a25fd61b402ed1d0cedeef756650f1ef7d34eccfe84597bb9f06dd6302/pygelf-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "f6d08ed86517aec4f0b97d5c613f4a61", "sha256": "f170fabe2b3911b9ff53e6e741b53e8961aef8f49bd33bac8dafd27f2a02a925" }, "downloads": -1, "filename": "pygelf-0.2.6.tar.gz", "has_sig": false, "md5_digest": "f6d08ed86517aec4f0b97d5c613f4a61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4740, "upload_time": "2016-10-08T11:00:50", "url": "https://files.pythonhosted.org/packages/b0/3e/561d57c68ca5f2c9ad73a34393230ab5447d9a89c1fc4f27b8b81d162748/pygelf-0.2.6.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "7012a8046062c83e33ab6d0aa09d4795", "sha256": "1d57ddafc18f5a625e199326f9ad0548c15d4fb496b26407ed8c5a239e63dd34" }, "downloads": -1, "filename": "pygelf-0.2.7.tar.gz", "has_sig": false, "md5_digest": "7012a8046062c83e33ab6d0aa09d4795", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4671, "upload_time": "2016-10-16T21:19:34", "url": "https://files.pythonhosted.org/packages/6f/cb/3f0b67e16989f8a742708a2071d36e0e061bf02811c692d0fde9dab128f1/pygelf-0.2.7.tar.gz" } ], "0.2.8": [ { "comment_text": "", "digests": { "md5": "def0bd21a388214b5d4588fb780a3a88", "sha256": "a05ac729f8304fcbdb5d8948c734333f681388cafbbfa9deb8246b5d00660024" }, "downloads": -1, "filename": "pygelf-0.2.8.tar.gz", "has_sig": false, "md5_digest": "def0bd21a388214b5d4588fb780a3a88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5367, "upload_time": "2016-12-08T23:18:12", "url": "https://files.pythonhosted.org/packages/2f/cf/7e6f0acf5da05b066da532098a1421ca3106338be0cdd1e62d5c6533bbcd/pygelf-0.2.8.tar.gz" } ], "0.2.9": [ { "comment_text": "", "digests": { "md5": "658aed8a43c012e75338ff9b74a54211", "sha256": "d49be7f8ec67fe9c0c075a3049e0caf54c99d881cf25ea77127ff5a19b28e394" }, "downloads": -1, "filename": "pygelf-0.2.9.tar.gz", "has_sig": false, "md5_digest": "658aed8a43c012e75338ff9b74a54211", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5699, "upload_time": "2016-12-28T13:17:49", "url": "https://files.pythonhosted.org/packages/d2/18/634031061f5982a8315fa23cc60239eaf5b74251608149f574d3cc56eca5/pygelf-0.2.9.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "ceea5492824617489c2b0e0801785152", "sha256": "000327dfd928169a339dddc9a91f73e8223a786cd633e86308e5017ca7878e07" }, "downloads": -1, "filename": "pygelf-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ceea5492824617489c2b0e0801785152", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9294, "upload_time": "2017-03-11T19:08:46", "url": "https://files.pythonhosted.org/packages/b7/82/351886e594d8cf4783906ff13b24c1256e5e988d8596a5c5fa92aef096ea/pygelf-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "1b56adf77d944949c435d6401d5e0c0c", "sha256": "aa2ba4120517a51d583eeaa5d5d8fff77c579b6afbedfc7acf79df9508b9c196" }, "downloads": -1, "filename": "pygelf-0.3.1.tar.gz", "has_sig": false, "md5_digest": "1b56adf77d944949c435d6401d5e0c0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9423, "upload_time": "2017-03-12T08:06:53", "url": "https://files.pythonhosted.org/packages/bf/f3/0a1b034d917e9f2451cade049411292eca90de6862466c293242b7b3bc98/pygelf-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "f79dc28b19b62c4dafc16e3c90d4eb38", "sha256": "f98a587012a99a04e3e3f1a8c402d7ffd23f9e026e1a926ab8ca5302b46169b1" }, "downloads": -1, "filename": "pygelf-0.3.2.tar.gz", "has_sig": false, "md5_digest": "f79dc28b19b62c4dafc16e3c90d4eb38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8976, "upload_time": "2017-11-09T20:29:01", "url": "https://files.pythonhosted.org/packages/ed/ad/ac7d51afeb24d730c69b359af24981b17a30089da921789ea1c95ea4638c/pygelf-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "5f67c8e3c5b6337b864a0c7f442fd047", "sha256": "3b3d522024162a3a08a3e5fcc26c81956bcf94f3e3b24ae871a947a1aecbb2ad" }, "downloads": -1, "filename": "pygelf-0.3.3.tar.gz", "has_sig": false, "md5_digest": "5f67c8e3c5b6337b864a0c7f442fd047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9249, "upload_time": "2017-11-21T23:00:43", "url": "https://files.pythonhosted.org/packages/cb/15/b9349ea559f45b54289d14af33856a4862e9cc806f93fdfdaf90b4d6ea44/pygelf-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "60649e3c701846ffd3a5c6905f26c2c6", "sha256": "f2e2af0d2731b7787b568120ec7bf5ca34ca3958e6b8bc171d0875a6ddb6d505" }, "downloads": -1, "filename": "pygelf-0.3.4.tar.gz", "has_sig": false, "md5_digest": "60649e3c701846ffd3a5c6905f26c2c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12100, "upload_time": "2018-07-03T18:20:10", "url": "https://files.pythonhosted.org/packages/51/1b/f06d5ca71bc34cc546cc6341faa239a09d3243c1250148f2cd278ff92584/pygelf-0.3.4.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "27e8ac55762f93d9052f66b440d01094", "sha256": "e2df467b215b8d114130aa4b48e609ec4d8d7d6b1a99d71749c8a72dc5c64a84" }, "downloads": -1, "filename": "pygelf-0.3.5-py3-none-any.whl", "has_sig": false, "md5_digest": "27e8ac55762f93d9052f66b440d01094", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10375, "upload_time": "2019-01-30T15:17:31", "url": "https://files.pythonhosted.org/packages/1e/4a/85dfdff161ebefb529ea4cf93fce9eb903475dd3e38b6a810c0d647111e4/pygelf-0.3.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eced3e1408b682a1a7469ff0bd472be8", "sha256": "d72772b2facbf6accdd667d06bd062dee23249209ebdb6e70a5c53bee73b5e1f" }, "downloads": -1, "filename": "pygelf-0.3.5.tar.gz", "has_sig": false, "md5_digest": "eced3e1408b682a1a7469ff0bd472be8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9738, "upload_time": "2019-01-30T15:17:33", "url": "https://files.pythonhosted.org/packages/29/a8/b1486e26fe8a62d6cb2275ba88b76fce4494edcc61322fde26781fb50c90/pygelf-0.3.5.tar.gz" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "0506680dd8802dd061894448301fcd6c", "sha256": "3e5bc59e3b5a754556a76ff2c69fcf2003218ad7b5ff8417482fa1f6a7eba5f9" }, "downloads": -1, "filename": "pygelf-0.3.6.tar.gz", "has_sig": false, "md5_digest": "0506680dd8802dd061894448301fcd6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10494, "upload_time": "2019-07-12T21:39:01", "url": "https://files.pythonhosted.org/packages/5e/4f/a6224902db19be061ffb090a247014c4716d45e5c97ae4d143321e818092/pygelf-0.3.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0506680dd8802dd061894448301fcd6c", "sha256": "3e5bc59e3b5a754556a76ff2c69fcf2003218ad7b5ff8417482fa1f6a7eba5f9" }, "downloads": -1, "filename": "pygelf-0.3.6.tar.gz", "has_sig": false, "md5_digest": "0506680dd8802dd061894448301fcd6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10494, "upload_time": "2019-07-12T21:39:01", "url": "https://files.pythonhosted.org/packages/5e/4f/a6224902db19be061ffb090a247014c4716d45e5c97ae4d143321e818092/pygelf-0.3.6.tar.gz" } ] }