Metadata-Version: 2.1
Name: dissec
Version: 1.0
Summary: Dissect pattern implementation for ElasticSearch
Home-page: https://dissec.touhey.pro/
Keywords: elasticsearch,dissect,processor,parsing
Author: Thomas Touhey
Author-email: thomas@touhey.fr
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: CeCILL-C Free Software License Agreement (CECILL-C)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Dist: eval-type-backport (>=0.2,<0.3) ; python_version < "3.10"
Requires-Dist: pydantic (>=2.7.1,<3.0.0)
Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
Project-URL: Repository, https://gitlab.com/kaquel/dissec
Description-Content-Type: text/x-rst

``dissec`` -- Dissect pattern implementation for ElasticSearch
==============================================================

    He attac, he protec, but most importantly, he dissec.

``dissec`` is a Python module used for implementing string dissection patterns,
compatible with ElasticSearch's `Dissect processor`_.

The project is present at the following locations:

* `Official website and documentation <Website_>`_;
* `Official repository on Gitlab <Gitlab repository_>`_;
* `Official project on PyPI <PyPI project_>`_.

For example, you can dissect a string using this module with the following
snippet:

.. code-block:: python

    from dissec.patterns import Pattern

    pattern = Pattern.parse(
        r'%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} '
        + r'HTTP/%{httpversion}\" %{status} %{size}',
    )
    result = pattern.dissect(
        r'1.2.3.4 - - [30/Apr/1998:22:00:52 +0000] '
        + r'\"GET /english/venues/cities/images/montpellier/18.gif '
        + r'HTTP/1.0\" 200 3171',
    )
    print(result)

This will print the following, pretty-printed here for readability purposes:

.. code-block:: text

    {'@timestamp': '30/Apr/1998:22:00:52 +0000',
     'auth': '-',
     'clientip': '1.2.3.4',
     'httpversion': '1.0',
     'ident': '-',
     'request': '/english/venues/cities/images/montpellier/18.gif',
     'size': '3171',
     'status': '200',
     'verb': 'GET'}

See `Dissecting a string using dissect patterns`_ for more details on this
usage.

.. _Website: https://dissec.touhey.pro/
.. _Gitlab repository: https://gitlab.com/kaquel/dissec
.. _PyPI project: https://pypi.org/project/dissec/
.. _Dissect processor:
    https://www.elastic.co/guide/en/elasticsearch/reference/current/
    dissect-processor.html
.. _Dissecting a string using dissect patterns:
    https://dissec.touhey.pro/developer-guides/dissect.html

