{ "info": { "author": "vavarachen", "author_email": "vavarachen@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: System :: Logging" ], "description": "# Installation\n\n```\npip install splunk-hec-handler\n```\n\n# Features\n1. Log messages to Splunk via HTTP Event Collector (HEC).\nSee [Splunk HEC Documentation](http://docs.splunk.com/Documentation/Splunk/latest/Data/AboutHEC)\n2. All messages are logged as '_json' sourcetype by default.\n3. A dictionary with 'log_level' and 'message' keys are constructed for logging records of type string.\n\n![String log record representation in Splunk](https://github.com/vavarachen/splunk_http_handler/blob/master/resources/str_record.png)\n\n4. Dictionary objects are preserved as JSON.\n\n![Dictionary log record representation in Splunk](https://github.com/vavarachen/splunk_http_handler/blob/master/resources/dict_record.png)\n\n5. If log record (dict) does not contains a 'time' field, one is added with the value set to current time.\n\n# Examples\n\n## Basic\n```python\nimport logging\nfrom splunk_hec_handler import SplunkHecHandler\nlogger = logging.getLogger('SplunkHecHandlerExample')\nlogger.setLevel(logging.DEBUG)\n\n# If using self-signed certificate, set ssl_verify to False\n# If using http, set proto to http\nsplunk_handler = SplunkHecHandler('splunkfw.domain.tld',\n 'EA33046C-6FEC-4DC0-AC66-4326E58B54C3',\n port=8888, proto='https', ssl_verify=True,\n source=\"HEC_example\")\nlogger.addHandler(splunk_handler)\n```\n\nFollowing should result in a Splunk entry with _time set to current timestamp.\n\n```python\nlogger.info(\"Testing Splunk HEC Info message\")\n```\n\n![Basic Example](https://github.com/vavarachen/splunk_http_handler/blob/master/resources/basic_example.png)\n\nFollowing should result in a Splunk entry of Monday, 08/06/2018 4:33:43 AM, and contain two\ncustom fields (color, api_endpoint). Custom fields can be seen in verbose mode. \n\n```python\ndict_obj = {'time': 1533530023, 'fields': {'color': 'yellow', 'api_endpoint': '/results'},\n 'user': 'foobar', 'app': 'my demo', 'severity': 'low', 'error codes': [1, 23, 34, 456]}\nlogger.error(dict_obj)\n```\n\n![Fields Example](https://github.com/vavarachen/splunk_http_handler/blob/master/resources/fields_example.png)\n\n:warning: In order to use custom fields, 'sourcetype' property must be specified in the event \nand sourcetype definition must enable *indexed field extractions*.\n\n\nSee http://dev.splunk.com/view/event-collector/SP-CAAAE6P for 'fields'\n\n## Advanced\nUsing 'fields', many of the metadata fields associated with an event can be changed from the default. Additionally, new\nfields, which are not part of the event, can be also added.\n\nIn the following example, we are sending events to two different indexes (see \"Select Allowed Indexes (optional)\" setting)\nand overriding 'host', 'source', 'sourcetype' fields, while adding some new fields ('color', 'api_endpoint').\n\n```python\nimport logging\nfrom splunk_hec_handler import SplunkHecHandler\n\nlogger = logging.getLogger('SplunkHecHandlerExample')\nlogger.setLevel(logging.DEBUG)\n\nstream_handler = logging.StreamHandler()\nstream_handler.level = logging.DEBUG\nlogger.addHandler(stream_handler)\n\ntoken = \"EA33046C-6FEC-4DC0-AC66-4326E58B54C3'\nsplunk_handler = SplunkHecHandler('splunkfw.domain.tld',\n token, index=\"hec\",\n port=8080, proto='https', ssl_verify=False\n source=\"evtx2json\", sourcetype='xxxxxxxx_json')\nlogger.addHandler(splunk_handler)\n\n\ndict_obj = {'fields': {'color': 'yellow', 'api_endpoint': '/results', 'host': 'app01', 'index':'hec'},\n 'user': 'foobar', 'app': 'my demo', 'severity': 'low', 'error codes': [1, 23, 34, 456]}\nlogger.info(dict_obj)\n\nlog_summary_evt = {'fields': {'index': 'adhoc', 'sourcetype': '_json', 'source': 'adv_example'}, 'exit code': 0, 'events logged': 100}\nlogger.debug(log_summary_evt)\n```\n\n![Advanced Fields Example](https://github.com/vavarachen/splunk_http_handler/blob/master/resources/advanced_example.png)\n\n\n# Todo\n1. Event acknowledgement support\n\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/vavarachen/splunk_hec_handler", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "splunk-hec-handler", "package_url": "https://pypi.org/project/splunk-hec-handler/", "platform": "", "project_url": "https://pypi.org/project/splunk-hec-handler/", "project_urls": { "Homepage": "https://github.com/vavarachen/splunk_hec_handler" }, "release_url": "https://pypi.org/project/splunk-hec-handler/1.0.9/", "requires_dist": [ "requests (<3.0.0,>=2.6.0)", "requests" ], "requires_python": "", "summary": "A Python logging handler to sends logs to Splunk using HTTP event collector (HEC)", "version": "1.0.9" }, "last_serial": 5359445, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "d9aee5a08fab697e6dcdfc18b6a1a272", "sha256": "61f23a7790c27256c13b7dee3152359b7a7d47eff4d3e0e57c028b970cab3d62" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d9aee5a08fab697e6dcdfc18b6a1a272", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4422, "upload_time": "2018-07-12T20:24:47", "url": "https://files.pythonhosted.org/packages/62/98/eb2d616aa4339825adb19ba46f2a95b6adcf63fe6e7169eed67bfc08d5d3/splunk_hec_handler-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9a7d690279282113908ccf7274b5306", "sha256": "fb6b2a4c0a9b29eb37e514408fad2cc88341ee4040dd48a32c42c914940827cb" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.1.tar.gz", "has_sig": false, "md5_digest": "a9a7d690279282113908ccf7274b5306", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3949, "upload_time": "2018-07-12T20:24:48", "url": "https://files.pythonhosted.org/packages/87/a9/cf3beb3234ac5f4a7dde59eeb1ecc433fb9fb8568148116f5bee0f23f831/splunk_hec_handler-1.0.1.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "cf80640224df1c7c17b1bfae7530a3bd", "sha256": "16072bbf76960ac362868af6f4a7df9c2723aaab69628a4f3d3860073413d658" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "cf80640224df1c7c17b1bfae7530a3bd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5259, "upload_time": "2018-08-06T14:17:39", "url": "https://files.pythonhosted.org/packages/16/ec/52b3e1408d9e9dee0b5acc2ee1428b1def70e4d11676f64a9b9cc7b6f425/splunk_hec_handler-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4bb1c53c888b20d6998d2a9d668e64b7", "sha256": "f4373edd7babc20ac104956e8c0fd789ed65e4b46cc7e10ed9a1c2c384cf42b6" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.4.tar.gz", "has_sig": false, "md5_digest": "4bb1c53c888b20d6998d2a9d668e64b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4505, "upload_time": "2018-08-06T14:17:40", "url": "https://files.pythonhosted.org/packages/b1/6d/6161c7ea26b2a58d64e2a7fbd51adc6ddf0e5ca7919927d3f16c558ed6d8/splunk_hec_handler-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "82e8cc5ec4724cb1875e82c7f8d2555e", "sha256": "4296e7cd24851de957f86fc295a7ea8acb43f5c0b7871752f34227c20e6d7873" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "82e8cc5ec4724cb1875e82c7f8d2555e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5885, "upload_time": "2018-08-20T20:43:40", "url": "https://files.pythonhosted.org/packages/29/c6/c77f34a2c46a402f6bc88b82fb909c888b6622540d30cffc071a19670ed2/splunk_hec_handler-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "684738afaf951600f46c794d507af3b4", "sha256": "05dcdb7fe6ab0f88563bbdba99314b458a7496efca0e6815106276d000e00d04" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.5.tar.gz", "has_sig": false, "md5_digest": "684738afaf951600f46c794d507af3b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4924, "upload_time": "2018-08-20T20:43:41", "url": "https://files.pythonhosted.org/packages/85/3f/4dc8fd082049fa3e27346e69994045c45b3ecee2255ee23bfd9d4f27a786/splunk_hec_handler-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "8dd4b48a06f569c6f98000745881ab9f", "sha256": "60c1cd64b724af9865fb401b2d941508c9437dc7104d91b2ff1a44482db763d6" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "8dd4b48a06f569c6f98000745881ab9f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6804, "upload_time": "2018-10-03T15:48:51", "url": "https://files.pythonhosted.org/packages/f7/8d/ab6e21ba5505958a1340ae2e8f245c067c9cb101779ebb802776a4d48644/splunk_hec_handler-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "058ec19f696ff4f0f0665132544c4119", "sha256": "0bbea2fbd8865855b119cf1900339cc72f28d51a094fa605f5857d72d8f24b53" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.6.tar.gz", "has_sig": false, "md5_digest": "058ec19f696ff4f0f0665132544c4119", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4992, "upload_time": "2018-10-03T15:48:52", "url": "https://files.pythonhosted.org/packages/90/88/bc30d6a48bc0fd53631569fe453abf62be5ea75eba2624f8643a57ca4065/splunk_hec_handler-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "6ad8536593a845fe3448f33aff8302f4", "sha256": "1621b887b9547f89caa167cd0f759b3bb100366c1bc938b232915a7f41fac0a9" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "6ad8536593a845fe3448f33aff8302f4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6803, "upload_time": "2019-02-21T17:43:10", "url": "https://files.pythonhosted.org/packages/c9/59/6586e7f19b61956b0e3ea89ba3b661f390ba146fff489e30c4fa5b874ab6/splunk_hec_handler-1.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5fd57787d39292219de8a8b0b2172aef", "sha256": "c1c38dfe89a7b821b90de9608c2180d08945fe357e1cd9930c5eda50614dc356" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.7.tar.gz", "has_sig": false, "md5_digest": "5fd57787d39292219de8a8b0b2172aef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5238, "upload_time": "2019-02-21T17:43:12", "url": "https://files.pythonhosted.org/packages/52/36/c968474faad709aaa58c9181c1278ef226e086fd37fbeebf7dd6cd9485d9/splunk_hec_handler-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "17057171785194d8ba6a60e4ca18e465", "sha256": "f0522456c5fb80d08f4a7c0ac939e13919d62e284bab37fcbada351e31b38612" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "17057171785194d8ba6a60e4ca18e465", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6828, "upload_time": "2019-02-22T15:10:04", "url": "https://files.pythonhosted.org/packages/34/5e/e4c7f8423ccfca1f4b76a0a1d1f2ae49f90e4e8c69817ad7e92a2a3f01e6/splunk_hec_handler-1.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "592cf7e8ef0b88f91c5aa93667ee0869", "sha256": "f73433e62ac27a894d03dca1c3d2b452ff909ba8d124691d7d3bf289c08cfbfe" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.8.tar.gz", "has_sig": false, "md5_digest": "592cf7e8ef0b88f91c5aa93667ee0869", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5278, "upload_time": "2019-02-22T15:10:06", "url": "https://files.pythonhosted.org/packages/0e/35/cddf85fd0d88ba2465857870ed279443cd710c09a8cf38681cb558ffd13a/splunk_hec_handler-1.0.8.tar.gz" } ], "1.0.9": [ { "comment_text": "", "digests": { "md5": "916fec5748ee9a31ef1740f18e7c8d07", "sha256": "82efd0d6455d9377b4625e7bb2e4e91537b6a014453bcd8210a8f88fc225f6f4" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "916fec5748ee9a31ef1740f18e7c8d07", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6899, "upload_time": "2019-06-04T20:09:52", "url": "https://files.pythonhosted.org/packages/bf/3e/f18854ce459728d868df8adbbd51ef67c5cb2950a4ff911a1b05509263ce/splunk_hec_handler-1.0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d2ee5f9b837791810f55862f1b36f33d", "sha256": "4a7dbb442d2d9d522589c1b859af84c8d4f931bb12f71d5146b5e0b0d4934c32" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.9.tar.gz", "has_sig": false, "md5_digest": "d2ee5f9b837791810f55862f1b36f33d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5335, "upload_time": "2019-06-04T20:09:53", "url": "https://files.pythonhosted.org/packages/f7/5a/fb6e00f70ab9f84c3b0f7b25319e7d7e41a85f1973030bb27f707859b044/splunk_hec_handler-1.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "916fec5748ee9a31ef1740f18e7c8d07", "sha256": "82efd0d6455d9377b4625e7bb2e4e91537b6a014453bcd8210a8f88fc225f6f4" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "916fec5748ee9a31ef1740f18e7c8d07", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6899, "upload_time": "2019-06-04T20:09:52", "url": "https://files.pythonhosted.org/packages/bf/3e/f18854ce459728d868df8adbbd51ef67c5cb2950a4ff911a1b05509263ce/splunk_hec_handler-1.0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d2ee5f9b837791810f55862f1b36f33d", "sha256": "4a7dbb442d2d9d522589c1b859af84c8d4f931bb12f71d5146b5e0b0d4934c32" }, "downloads": -1, "filename": "splunk_hec_handler-1.0.9.tar.gz", "has_sig": false, "md5_digest": "d2ee5f9b837791810f55862f1b36f33d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5335, "upload_time": "2019-06-04T20:09:53", "url": "https://files.pythonhosted.org/packages/f7/5a/fb6e00f70ab9f84c3b0f7b25319e7d7e41a85f1973030bb27f707859b044/splunk_hec_handler-1.0.9.tar.gz" } ] }