{ "info": { "author": "Niels Albers", "author_email": "nralbers@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==========================================================================\n``structlog-extensions-nralbers``: Extension processors for ``structlog``\n==========================================================================\n\n.. -begin-short-\n\nStructlog extensions are a set of `structlog `_ processors and utility functions\nto add new logging options to structlog. The primary purpose is to supply tools to convert existing structlog\nlogging output into `Elastic Common Schema `_\njson output so users can easily plug their application output into centralised logging solutions such as\n`ELK stack `_.\n\nAt present the extensions consist of a ``CombinedLogParser`` (which for example can be used to convert gunicorn access log\noutput into ECS fields), and the ``NestedDictJSONRenderer``, which can be used to convert the output of the CombinedLogParser\ninto ECS json format output.\n\n.. -end-short-\n\nUsage\n=====\n\n.. -begin-usage-\n\n``CombinedLogParser``\n---------------------\n\nThis processor will parse events formatted in Apache Combined log format into\nElastic common schema fields.\n\nExample\n^^^^^^^\n\nThis is an example for configuring gunicorn to emit json logs.\n\n``gunicorn.conf.py``\n\n.. code-block:: python\n\n import structlog\n import structlog_extensions\n\n # --- Structlog logging initialisation code\n\n pre_chain = [\n # Add the log level and a timestamp to the event_dict if the log entry\n # is not from structlog.\n structlog.stdlib.add_log_level,\n structlog.stdlib.add_logger_name,\n structlog_extensions.processors.CombinedLogParser(\"gunicorn.access\")\n ]\n\n logconfig_dict = {\n \"version\": 1,\n \"disable_existing_loggers\": False,\n \"formatters\": {\n \"json_formatter\": {\n \"()\": structlog.stdlib.ProcessorFormatter,\n \"processor\": structlog.processors.JSONRenderer(),\n \"foreign_pre_chain\": pre_chain,\n }\n },\n \"handlers\": {\n \"error_console\": {\n \"class\": \"logging.StreamHandler\",\n \"formatter\": \"json_formatter\",\n },\n \"console\": {\n \"class\": \"logging.StreamHandler\",\n \"formatter\": \"json_formatter\",\n }\n },\n }\n\n\n``NestedDictJSONRenderer``\n--------------------------\n\nThis processor will convert key names using a specified separator into nested dictionaries prior to rendering the\noutput as JSON using the structlog JSONRenderer. This processor can for example convert Elastic Common Schema namespaced\nkeynames produced by the ``CombinedLogParser`` into the nested JSON format that ECS specifies. This processor must be the\nfinal processor in a chain because it renders the output as a string instead of passing along an event dictionary.\n\nExample\n^^^^^^^\n\nWhen using this logging initialisation:\n\n .. code-block:: python\n\n # --- std logging initialisation code using structlog rendering\n import structlog\n import structlog_extensions\n\n pre_chain = [\n # Add the log level and a timestamp to the event_dict if the log entry\n # is not from structlog.\n structlog.stdlib.add_log_level,\n structlog.stdlib.add_logger_name,\n structlog_extensions.processors.CombinedLogParser(\"gunicorn.access\")\n ]\n\n logging.dict_config( {\n \"version\": 1,\n \"disable_existing_loggers\": False,\n \"formatters\": {\n \"json_formatter\": {\n \"()\": structlog.stdlib.ProcessorFormatter,\n \"processor\": structlog_extensions.processors.NestedDictJSONRenderer('.'),\n \"foreign_pre_chain\": pre_chain,\n }\n },\n \"handlers\": {\n \"error_console\": {\n \"class\": \"logging.StreamHandler\",\n \"formatter\": \"json_formatter\",\n },\n \"console\": {\n \"class\": \"logging.StreamHandler\",\n \"formatter\": \"json_formatter\",\n }\n },\n })\n\n These entries (produced by ``structlog_extensions.processors.CombinedLogParser``):\n\n .. code-block:: python\n\n { 'http.request.method': 'get', 'http:.request.referrer': 'http://www.example.com', 'http.version': '1.0'}`\n\n will be transformed into the following nested json structure:\n\n .. code-block:: python\n\n { 'http': { 'version': '1.0',\n 'request': { 'method': 'get',\n 'referrer': 'http://www.example.com'}\n }\n }\n\n.. --end-usage-\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://structlog-extensions-nralbers.readthedocs.io/en/latest/", "keywords": "logging,structured,structure,log,ecs,apache-combined-log", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "structlog-extensions-nralbers", "package_url": "https://pypi.org/project/structlog-extensions-nralbers/", "platform": "", "project_url": "https://pypi.org/project/structlog-extensions-nralbers/", "project_urls": { "Documentation": "https://structlog-extensions-nralbers.readthedocs.io/en/latest/", "Homepage": "https://structlog-extensions-nralbers.readthedocs.io/en/latest/", "Source": "https://github.com/nralbers/structlog-extensions-nralbers", "Tracker": "https://github.com/nralbers/structlog-extensions-nralbers/issues" }, "release_url": "https://pypi.org/project/structlog-extensions-nralbers/1.0.3/", "requires_dist": [ "structlog", "user-agents", "deepmerge", "pytz" ], "requires_python": "~=3.5", "summary": "Processors for Structlog library", "version": "1.0.3" }, "last_serial": 5831568, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "1fb8b9b8225068e99a518a68193d6d08", "sha256": "44a732cd2915056307f0623d48b5c0cf0558a2c650dc653935eb07f30653fa81" }, "downloads": -1, "filename": "structlog_extensions_nralbers-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1fb8b9b8225068e99a518a68193d6d08", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 11360, "upload_time": "2019-09-04T19:52:55", "url": "https://files.pythonhosted.org/packages/b2/19/52f170cf875b2d6db55af7834bb163f8455e55fd2078c85c714476b63e70/structlog_extensions_nralbers-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "907bf46de710b287efbde3432e47e1b7", "sha256": "ff67ebea6603ccabc287f024f11450f859a28f7212298aef2fe87844b431a0ac" }, "downloads": -1, "filename": "structlog-extensions-nralbers-1.0.0.tar.gz", "has_sig": false, "md5_digest": "907bf46de710b287efbde3432e47e1b7", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 8512, "upload_time": "2019-09-04T19:52:58", "url": "https://files.pythonhosted.org/packages/9e/5e/0dd147934d5e2660c9c30e066c97dfa188a52b6a36f1b844335f866aaf7e/structlog-extensions-nralbers-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0e1b30eaf13166a648d8623997cc64b2", "sha256": "80ae610b10e15c2bff4be22a7588da1ade30c178b7ef1c342ddd1af265614844" }, "downloads": -1, "filename": "structlog_extensions_nralbers-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e1b30eaf13166a648d8623997cc64b2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 11366, "upload_time": "2019-09-04T21:14:22", "url": "https://files.pythonhosted.org/packages/81/ca/cef79787f7b63b7080d571a097ad84f7e938862c29062908d5428572bb7d/structlog_extensions_nralbers-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7cf81a75d92a92e0432ddd4f6900420b", "sha256": "6624406f7ef928b6e9fa211ce7bef550eb8f0056d103390f4dd1fd11ce8c3ccb" }, "downloads": -1, "filename": "structlog-extensions-nralbers-1.0.1.tar.gz", "has_sig": false, "md5_digest": "7cf81a75d92a92e0432ddd4f6900420b", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 8520, "upload_time": "2019-09-04T21:14:25", "url": "https://files.pythonhosted.org/packages/26/98/04f5f5442a47b93b1911c69806dcdf54835a56a4aef40faa8eeefe5551a1/structlog-extensions-nralbers-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "1f16ede3b980dcd7d7195aece0b3e587", "sha256": "968d7ff6228a33594c12ae77b9593f0aeb0db39570d1853ec6e9705a3adc9ca5" }, "downloads": -1, "filename": "structlog_extensions_nralbers-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "1f16ede3b980dcd7d7195aece0b3e587", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 11365, "upload_time": "2019-09-04T21:20:24", "url": "https://files.pythonhosted.org/packages/98/78/a5295d4647f271f172075e301ce4735db4a641f408b5498e4ce09176b6f5/structlog_extensions_nralbers-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5239d89e2e5c2a6347937866b1d6d647", "sha256": "aeefce9566343234c81bca6802549db40923afda1d964f0825e0b2eb9b29d03f" }, "downloads": -1, "filename": "structlog-extensions-nralbers-1.0.2.tar.gz", "has_sig": false, "md5_digest": "5239d89e2e5c2a6347937866b1d6d647", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 8510, "upload_time": "2019-09-04T21:20:26", "url": "https://files.pythonhosted.org/packages/d9/e2/fbd63e2e47414be80d3b494cc0c4df60f5229b72cf135e8c68a54e9bb58c/structlog-extensions-nralbers-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "c8cf11efeb231e37aab1440156e5c6ae", "sha256": "0e991d3445f53dba3624ac328ac842bb7815544c4d90c26507c7aad0f843dc10" }, "downloads": -1, "filename": "structlog_extensions_nralbers-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c8cf11efeb231e37aab1440156e5c6ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 11396, "upload_time": "2019-09-15T11:31:00", "url": "https://files.pythonhosted.org/packages/f6/7c/1dcd451f8611af4adf8cd698a78e5c2acaf2c60db287a11e20105cd99221/structlog_extensions_nralbers-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ee2b5965671ca2c9504642c0569ca14", "sha256": "c8bc75c21c2db5562be314b489c4baf44764234d891ffd2318965df302e94929" }, "downloads": -1, "filename": "structlog-extensions-nralbers-1.0.3.tar.gz", "has_sig": false, "md5_digest": "8ee2b5965671ca2c9504642c0569ca14", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 8537, "upload_time": "2019-09-15T11:31:03", "url": "https://files.pythonhosted.org/packages/92/e5/c753b1d2d14ca769b8edce71672a7c89aee5f3a7133c492367d4f0acb40b/structlog-extensions-nralbers-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c8cf11efeb231e37aab1440156e5c6ae", "sha256": "0e991d3445f53dba3624ac328ac842bb7815544c4d90c26507c7aad0f843dc10" }, "downloads": -1, "filename": "structlog_extensions_nralbers-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c8cf11efeb231e37aab1440156e5c6ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 11396, "upload_time": "2019-09-15T11:31:00", "url": "https://files.pythonhosted.org/packages/f6/7c/1dcd451f8611af4adf8cd698a78e5c2acaf2c60db287a11e20105cd99221/structlog_extensions_nralbers-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ee2b5965671ca2c9504642c0569ca14", "sha256": "c8bc75c21c2db5562be314b489c4baf44764234d891ffd2318965df302e94929" }, "downloads": -1, "filename": "structlog-extensions-nralbers-1.0.3.tar.gz", "has_sig": false, "md5_digest": "8ee2b5965671ca2c9504642c0569ca14", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 8537, "upload_time": "2019-09-15T11:31:03", "url": "https://files.pythonhosted.org/packages/92/e5/c753b1d2d14ca769b8edce71672a7c89aee5f3a7133c492367d4f0acb40b/structlog-extensions-nralbers-1.0.3.tar.gz" } ] }