tlssysloghandler


Nametlssysloghandler JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummarySysLogHandler with TLS
upload_time2025-10-19 17:37:56
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseISC
keywords handler logging logger syslog tls
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ======================
SysLogHandler with TLS
======================

Python logging.handler as a drop-in replacement for logging.SysLogHandler with support for sending syslog messages over TCP with TLS.

Installation
------------

.. code:: bash

    pip install tlssysloghandler


Usage
-----

.. code:: python

    import logging
    from tlssysloghandler import TLSSysLogHandler

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)

    # with default system certificate store
    handler1 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
                                socktype=socket.SOCK_STREAM,
                                secure=True)
    logger.addHandler(handler1)

    # with custom certificates, via cafile/capath/cadata
    # refer to https://docs.python.org/3/library/ssl.html#ssl.create_default_context
    handler2 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), 
                                socktype=socket.SOCK_STREAM,
                                secure={cafile='/path/to/ca/file'})
    logger.addHandler(handler2)

    # with custom SSLContext (e.g. for mutual TLS authentication)
    context = ssl.create_default_context(
        purpose=ssl.Purpose.SERVER_AUTH, cafile="/path/to/ca/file"
    )
    context.load_cert_chain(
        certfile="/path/to/client/cert.pem",
        keyfile="/path/to/client/priv.key",
    )
    handler3 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), 
                                socktype=socket.SOCK_STREAM,
                                secure=context)
    logger.addHandler(handler3)

    # or allow TLS without verification (not recommended)
    handler4 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), 
                                socktype=socket.SOCK_STREAM,
                                secure="noverify")
    logger.addHandler(handler4)

    logger.info('Hello, World!')

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tlssysloghandler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "handler, logging, logger, syslog, tls",
    "author": null,
    "author_email": "A Tammy <atammy@bsd.ac>, Craig Weber <crgwbr@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b3/c0/bedb495a9efd4941f3c1632d853868d8cd0455b8cc7d2607ff49c807c942/tlssysloghandler-2.0.0.tar.gz",
    "platform": null,
    "description": "======================\nSysLogHandler with TLS\n======================\n\nPython logging.handler as a drop-in replacement for logging.SysLogHandler with support for sending syslog messages over TCP with TLS.\n\nInstallation\n------------\n\n.. code:: bash\n\n    pip install tlssysloghandler\n\n\nUsage\n-----\n\n.. code:: python\n\n    import logging\n    from tlssysloghandler import TLSSysLogHandler\n\n    logger = logging.getLogger()\n    logger.setLevel(logging.INFO)\n\n    # with default system certificate store\n    handler1 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),\n                                socktype=socket.SOCK_STREAM,\n                                secure=True)\n    logger.addHandler(handler1)\n\n    # with custom certificates, via cafile/capath/cadata\n    # refer to https://docs.python.org/3/library/ssl.html#ssl.create_default_context\n    handler2 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), \n                                socktype=socket.SOCK_STREAM,\n                                secure={cafile='/path/to/ca/file'})\n    logger.addHandler(handler2)\n\n    # with custom SSLContext (e.g. for mutual TLS authentication)\n    context = ssl.create_default_context(\n        purpose=ssl.Purpose.SERVER_AUTH, cafile=\"/path/to/ca/file\"\n    )\n    context.load_cert_chain(\n        certfile=\"/path/to/client/cert.pem\",\n        keyfile=\"/path/to/client/priv.key\",\n    )\n    handler3 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), \n                                socktype=socket.SOCK_STREAM,\n                                secure=context)\n    logger.addHandler(handler3)\n\n    # or allow TLS without verification (not recommended)\n    handler4 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), \n                                socktype=socket.SOCK_STREAM,\n                                secure=\"noverify\")\n    logger.addHandler(handler4)\n\n    logger.info('Hello, World!')\n",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "SysLogHandler with TLS",
    "version": "2.0.0",
    "project_urls": {
        "License": "https://github.com/bsd-ac/tlssysloghandler/blob/main/LICENSE",
        "Repository": "https://github.com/bsd-ac/tlssysloghandler"
    },
    "split_keywords": [
        "handler",
        " logging",
        " logger",
        " syslog",
        " tls"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "997f1d6692f594199d3111d4935487c218f2a46a9d779dfd5a3f7195c6cca0ba",
                "md5": "1fd11db26b388e07cf88807bac8a79c9",
                "sha256": "b4d3beffeb2cfc421f066f556b697a1ea74d42fda2d328f73fbebbdcb9b82c8c"
            },
            "downloads": -1,
            "filename": "tlssysloghandler-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1fd11db26b388e07cf88807bac8a79c9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 4251,
            "upload_time": "2025-10-19T17:37:55",
            "upload_time_iso_8601": "2025-10-19T17:37:55.256226Z",
            "url": "https://files.pythonhosted.org/packages/99/7f/1d6692f594199d3111d4935487c218f2a46a9d779dfd5a3f7195c6cca0ba/tlssysloghandler-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b3c0bedb495a9efd4941f3c1632d853868d8cd0455b8cc7d2607ff49c807c942",
                "md5": "369e6cbb400e85df34b2e4ffd6dba35a",
                "sha256": "ee7ed78f858001f096b99e1f118b2c75cf9de65f4a92c9b6a05cca8a44bb98b7"
            },
            "downloads": -1,
            "filename": "tlssysloghandler-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "369e6cbb400e85df34b2e4ffd6dba35a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 8991,
            "upload_time": "2025-10-19T17:37:56",
            "upload_time_iso_8601": "2025-10-19T17:37:56.291234Z",
            "url": "https://files.pythonhosted.org/packages/b3/c0/bedb495a9efd4941f3c1632d853868d8cd0455b8cc7d2607ff49c807c942/tlssysloghandler-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-19 17:37:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bsd-ac",
    "github_project": "tlssysloghandler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tlssysloghandler"
}
        
Elapsed time: 3.81508s