{ "info": { "author": "Noam Yorav-Raphael", "author_email": "noamraph@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# logstash-filter-test\n[Logstash](https://www.elastic.co/products/logstash) is a program that collects\njson documents from various inputs, transform them according to a configuration\nfile (a *filter*), and sends them to various outputs. This script helps you make\nsure that your filter does what you expect by writing a test suite.\n\n## Installation\n\nYou can install using pip:\n\n```\npip install logstash-filter-test\n```\n\nor just copy `logstash_filter_run.py` and `logstash_filter_test.py`. There are\nno dependencies. Python 3.5+ and 2.7 are supported.\n\n## Example\n\nHere is a simple test suite file:\n\ntestcases.js:\n```javascript\n[\n // Test a message with a value\n [\n {\n \"message\": \"<<2018-06-11 13:45:39,127+0300>> TAU = 6.2831853\"\n },\n {\n \"date\": \"2018-06-11 13:45:39,127+0300\",\n \"@timestamp\": \"2018-06-11T10:45:39.127Z\",\n \"msg_text\": \"TAU = 6.2831853\",\n \"metric\": \"TAU\",\n \"value\": 6.2831853,\n }\n ],\n]\n```\n\nfilter.conf:\n```\nfilter {\n grok {\n match => {\n \"message\" => [\n \"^<<%{TIMESTAMP_ISO8601:date}>> %{GREEDYDATA:msg_text}$\"\n ]\n }\n }\n date {\n match => [\"date\", \"ISO8601\"]\n }\n grok {\n match => {\n \"msg_text\" => [\n \"^%{WORD:metric} = %{NUMBER:value:float}\"\n ]\n }\n tag_on_failure => []\n }\n}\n```\n\nPut them in a directory, run `./logstash_filter_test.py` and it will inform you\nif the testcases passed, and if not, why.\n\n`testcases.js` can be a simple json file. It has the extension `.js` because\njavascript comments and trailing commas are allowed, thanks to\n[jstyleson](https://github.com/linjackson78/jstyleson). It is a list of\ntest cases. Each test case is a list of size 2. The first item is the input \njson document. The second item is compared to the output json document. All\nfields that are defined must be equal to the fields in the output document.\nThe output document may include other fields. To test that an output field\ndoesn't exist, use `\"field\": null`.\n\n## Testing from Python\n\nIf you don't like the testcase file format, it's easy to test by yourself:\n\n```pydocstring\n>>> from logstash_filter_run import logstash_filter_run\n>>> logstash_filter_run([{\"a\": 3}], 'filter { mutate { copy => { \"a\" => \"b\" } } }')\n[{'@timestamp': '2018-07-10T18:26:58.411Z',\n '@version': '1',\n 'a': 3,\n 'b': 3,\n 'host': 'myhost'}]\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/noamraph/logstash-filter-test", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "logstash-filter-test", "package_url": "https://pypi.org/project/logstash-filter-test/", "platform": "", "project_url": "https://pypi.org/project/logstash-filter-test/", "project_urls": { "Homepage": "https://github.com/noamraph/logstash-filter-test" }, "release_url": "https://pypi.org/project/logstash-filter-test/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Easily test logstash filter", "version": "0.1.1" }, "last_serial": 4048286, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1c1c5a50bc3c3974b9973b80d4c1198a", "sha256": "fd567713af8d2d90e780ab0694ed13b5a0b05a33d2281147f2ffa7e46335c0e3" }, "downloads": -1, "filename": "logstash_filter_test-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1c1c5a50bc3c3974b9973b80d4c1198a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9013, "upload_time": "2018-07-10T19:12:44", "url": "https://files.pythonhosted.org/packages/7c/5a/5b1998760d333769fae1441733e95f1bbe3d4cfd2aaa383856ff65547381/logstash_filter_test-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c33a0474d66686f2eeb616fb3403b77", "sha256": "341d018091a94175588b0f6e8ac7694c5e0c03124b0c9cb783dda4569eea0c8c" }, "downloads": -1, "filename": "logstash-filter-test-0.1.tar.gz", "has_sig": false, "md5_digest": "0c33a0474d66686f2eeb616fb3403b77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4771, "upload_time": "2018-07-10T19:12:46", "url": "https://files.pythonhosted.org/packages/5f/7e/97f9aaacc7824bbcdf2bded22666fe97e53d49153516caa5a50cde48b2fb/logstash-filter-test-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d760b7d8deef42533172c4411bdbd55d", "sha256": "1ec91afffb395f92eb7e907e08592de6caff4042ed03750979327232be619ee5" }, "downloads": -1, "filename": "logstash_filter_test-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d760b7d8deef42533172c4411bdbd55d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7292, "upload_time": "2018-07-10T19:14:54", "url": "https://files.pythonhosted.org/packages/ab/68/7c87878dfc38040d77cc60d4ea3adefe94d8226c89781b5d9b3dfb56ced7/logstash_filter_test-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff9d84c13de7809429184a7839b55e5f", "sha256": "4720bdbf2b41935ffaea578e127df78088e190a1fad8ee3c00aaf03323531d31" }, "downloads": -1, "filename": "logstash-filter-test-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ff9d84c13de7809429184a7839b55e5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4890, "upload_time": "2018-07-10T19:14:56", "url": "https://files.pythonhosted.org/packages/70/92/d9260199cf63ca6cfce8addf0215efb90b85669dc36ecbe4aaa2edfa7a77/logstash-filter-test-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d760b7d8deef42533172c4411bdbd55d", "sha256": "1ec91afffb395f92eb7e907e08592de6caff4042ed03750979327232be619ee5" }, "downloads": -1, "filename": "logstash_filter_test-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d760b7d8deef42533172c4411bdbd55d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7292, "upload_time": "2018-07-10T19:14:54", "url": "https://files.pythonhosted.org/packages/ab/68/7c87878dfc38040d77cc60d4ea3adefe94d8226c89781b5d9b3dfb56ced7/logstash_filter_test-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff9d84c13de7809429184a7839b55e5f", "sha256": "4720bdbf2b41935ffaea578e127df78088e190a1fad8ee3c00aaf03323531d31" }, "downloads": -1, "filename": "logstash-filter-test-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ff9d84c13de7809429184a7839b55e5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4890, "upload_time": "2018-07-10T19:14:56", "url": "https://files.pythonhosted.org/packages/70/92/d9260199cf63ca6cfce8addf0215efb90b85669dc36ecbe4aaa2edfa7a77/logstash-filter-test-0.1.1.tar.gz" } ] }