Skip to main content

Python package template.

Project description

Overview

Usage examples

import pipelined

def detect_ddos(stream):
    access = pipelined.utils.limit_counter(10*1000)
    for log in stream:
        access[log.ip] += 1
        yield from access.over(100)

def block_ips(stream):
    for ip in stream:
        # block the ip
        yield ip

ddos_monitor = [
    detect_ddos,
    block_ips,
]

source_logs = pipelined.files.follow('/path/to/server/access.log')
for ip in pipelined.run(ddos_monitor, source_logs):
    print(ip, "has been blocked.")

License

See LICENSE.

Project details


Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page