memorydelaysmtphandler


Namememorydelaysmtphandler JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryMemoryDelaySmtpHandler will create a bundle of events in a single email and sent it after a delay.
upload_time2024-08-29 17:41:33
maintainerNone
docs_urlNone
authorvoid127001
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # memorydelaysmtphandler

## Overview
**memorydelaysmtphandler** adds new handlers for the Python logging package.

Issue : SMTPHandler sends one email after each event. Multiple emails can be received in a short time.<br> 
Improvement : MemoryDelaySmtpHandler will create a bundle of events in a single email and sent it after a delay.

## Features

**MemoryDelayHandler** class adds an auto-flush delay to logging.handlers.MemoryHandler.<br>
**MemoryDelaySmtpHandler** class adds an auto-flush delay to logging.handlers.SMTPHandler.

#### The handler is flushed when:
- the number of events is equal to the capacity
- the event of a certain severity occurs
- after a first event, the delay is reached

#### New parameters
- Initializes the handler with a buffer of the specified capacity. Here, capacity means the number of events records buffered.
- A delay in seconds to automatically flush the buffer after a first event. When the delay argument is not present or None, no automatic flushed is provided.

## Installation
```
$ python3 -m pip install memorydelaysmtphandler
```



## Using with OpenCanary

logging.handlers.SMTPHandler sends one email after each alert. Multiple emails can be received in a short time.<br> 
MemoryDelaySmtpHandler will create a bundle of alerts in a single email and sent it after a delay.

#### Installation for OpenCanary
Install memorydelaysmtphandler in the OpenCanary environment.

#### Edit /etc/opencanaryd/opencanary.conf
Change "class": "logging.handlers.SMTPHandler"<br>
by     "class": "memorydelaysmtphandler.memorydelaysmtphandler.MemoryDelaySmtpHandler"

add these parameters:
```
	"capacity" : your capacity,
	"delay" : your delay
```    

Example:
```
// [..] # Services configuration
    "logger": {
    "class" : "PyLogger",
    "kwargs" : {
        "handlers": {
            "SMTP": {
                "class": "memorydelaysmtphandler.memorydelaysmtphandler.MemoryDelaySmtpHandler",
                "mailhost": ["smtp.gmail.com", 587],
                "fromaddr": "noreply@yourdomain.com",
                "toaddrs" : ["youraddress@gmail.com"],
                "subject" : "OpenCanary Alert",
                "credentials" : ["youraddress", "abcdefghijklmnop"],
                "secure" : [],
                "capacity" : 128,
                "delay" : 60                
             }
         }
     }
 }
 ```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "memorydelaysmtphandler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "void127001",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/11/51/703b49acab9ceddfaabed4f28ddc90ce0c7f236c6b76e07abdd91091b5a9/memorydelaysmtphandler-1.0.2.tar.gz",
    "platform": null,
    "description": "# memorydelaysmtphandler\n\n## Overview\n**memorydelaysmtphandler** adds new handlers for the Python logging package.\n\nIssue : SMTPHandler sends one email after each event. Multiple emails can be received in a short time.<br> \nImprovement : MemoryDelaySmtpHandler will create a bundle of events in a single email and sent it after a delay.\n\n## Features\n\n**MemoryDelayHandler** class adds an auto-flush delay to logging.handlers.MemoryHandler.<br>\n**MemoryDelaySmtpHandler** class adds an auto-flush delay to logging.handlers.SMTPHandler.\n\n#### The handler is flushed when:\n- the number of events is equal to the capacity\n- the event of a certain severity occurs\n- after a first event, the delay is reached\n\n#### New parameters\n- Initializes the handler with a buffer of the specified capacity. Here, capacity means the number of events records buffered.\n- A delay in seconds to automatically flush the buffer after a first event. When the delay argument is not present or None, no automatic flushed is provided.\n\n## Installation\n```\n$ python3 -m pip install memorydelaysmtphandler\n```\n\n\n\n## Using with OpenCanary\n\nlogging.handlers.SMTPHandler sends one email after each alert. Multiple emails can be received in a short time.<br> \nMemoryDelaySmtpHandler will create a bundle of alerts in a single email and sent it after a delay.\n\n#### Installation for OpenCanary\nInstall memorydelaysmtphandler in the OpenCanary environment.\n\n#### Edit /etc/opencanaryd/opencanary.conf\nChange \"class\": \"logging.handlers.SMTPHandler\"<br>\nby     \"class\": \"memorydelaysmtphandler.memorydelaysmtphandler.MemoryDelaySmtpHandler\"\n\nadd these parameters:\n```\n\t\"capacity\" : your capacity,\n\t\"delay\" : your delay\n```    \n\nExample:\n```\n// [..] # Services configuration\n    \"logger\": {\n    \"class\" : \"PyLogger\",\n    \"kwargs\" : {\n        \"handlers\": {\n            \"SMTP\": {\n                \"class\": \"memorydelaysmtphandler.memorydelaysmtphandler.MemoryDelaySmtpHandler\",\n                \"mailhost\": [\"smtp.gmail.com\", 587],\n                \"fromaddr\": \"noreply@yourdomain.com\",\n                \"toaddrs\" : [\"youraddress@gmail.com\"],\n                \"subject\" : \"OpenCanary Alert\",\n                \"credentials\" : [\"youraddress\", \"abcdefghijklmnop\"],\n                \"secure\" : [],\n                \"capacity\" : 128,\n                \"delay\" : 60                \n             }\n         }\n     }\n }\n ```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "MemoryDelaySmtpHandler will create a bundle of events in a single email and sent it after a delay.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/void127001/memorydelaysmtphandler",
        "Issues": "https://github.com/void127001/memorydelaysmtphandler/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a09a9bacb2ce99ff7a655fe21b13c8e0df0a1628c9cfd985999caba92c0a4afc",
                "md5": "1d4c8a473f2dfe0e5e4f2119b1cb5efb",
                "sha256": "7e2f7963e1e8b7eef6943362bc666d2e938a8620eadeae74ff9b4c183ca1c97d"
            },
            "downloads": -1,
            "filename": "memorydelaysmtphandler-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1d4c8a473f2dfe0e5e4f2119b1cb5efb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 14476,
            "upload_time": "2024-08-29T17:41:32",
            "upload_time_iso_8601": "2024-08-29T17:41:32.480541Z",
            "url": "https://files.pythonhosted.org/packages/a0/9a/9bacb2ce99ff7a655fe21b13c8e0df0a1628c9cfd985999caba92c0a4afc/memorydelaysmtphandler-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1151703b49acab9ceddfaabed4f28ddc90ce0c7f236c6b76e07abdd91091b5a9",
                "md5": "bcd01ba5ffc972b2be918a32c36da0eb",
                "sha256": "6f9daef61e6eb949e7a71f355861be894a8c485531804b121fa68d80dca898e7"
            },
            "downloads": -1,
            "filename": "memorydelaysmtphandler-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bcd01ba5ffc972b2be918a32c36da0eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14404,
            "upload_time": "2024-08-29T17:41:33",
            "upload_time_iso_8601": "2024-08-29T17:41:33.986441Z",
            "url": "https://files.pythonhosted.org/packages/11/51/703b49acab9ceddfaabed4f28ddc90ce0c7f236c6b76e07abdd91091b5a9/memorydelaysmtphandler-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-29 17:41:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "void127001",
    "github_project": "memorydelaysmtphandler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "memorydelaysmtphandler"
}
        
Elapsed time: 0.58758s