Skip to main content

Simple server to gather data from fluentbit agent (forward protocol)

Project description

Fluentbit-server-py

Fluentd and Fluentbit are two great tools, like swiss knife. You can gather data, work on them and ship them to another FluentX instance. But what happen when you want to ship them to a Python program ? You need to do a workaround based on files, or stuff like that.

Well, that why it exists : if you need to gather data from fluentbit and process them in a python program (AI, exotic database, ...), you need that lib.

It implements a partial version for the forward protocol (https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1):

  • SSL support
  • authentication based on shared_key
  • transport forward mode only

This library is designed as server for Fluentbit and was not tested on Fluentd (maybe it works ?).

Example

import sys
import logging

from fluentbit_authentication import FluentbitAuthentication
from fluentbit_transport import FluentbitTransport
from fluentbit_request_handler import FluentbitRequestHandler
from fluentbit_server import FluentbitServer
from fluentbit_ssl import FluentbitSSL
from functools import partial

authentication_factory = partial(FluentbitAuthentication, shared_key="my_shared_key", server_hostname="server.com")
transport_factory = partial(FluentbitTransport, callback=print)
ssl = FluentbitSSL(key_file="etc/toto.com.key", crt_file="etc/toto.com.cert")


def main():
    logging.basicConfig(level=logging.DEBUG)

    server = FluentbitServer(("localhost", 24000), FluentbitRequestHandler, transport_factory, authentication_factory, ssl)

    try:
        server.serve_forever()
    except KeyboardInterrupt:
        pass
    except OSError:
        print("Socket in use")
    finally:
        server.server_close()
        print("closed")
        sys.exit(0)

if __name__ == "__main__":
    main()

Authentication and ssl are optionals so such line will product a basic server (no authentication, no ciphering):

server = FluentbitServer(("localhost", 24000), FluentbitRequestHandler, transport_factory)

Licence

This software is under MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fluentbit-server-py-1.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

fluentbit_server_py-1.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file fluentbit-server-py-1.0.1.tar.gz.

File metadata

  • Download URL: fluentbit-server-py-1.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for fluentbit-server-py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9b1624b2aff101aea1f7974749d3c71f48e7e7986cc8fd4b792c2fb12a550b9d
MD5 f7b180dd24c9a3cc927b6d5b3aa58821
BLAKE2b-256 35092376746ac4ec17bbf1bf8e7dd86e8f0dee0984234220f285ba9db8807c43

See more details on using hashes here.

Provenance

File details

Details for the file fluentbit_server_py-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: fluentbit_server_py-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for fluentbit_server_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b2117e1b91761b92a0eb12e9fbb76425979f5311447e039a855a6cd9c86265
MD5 7faf5df88f25d71397a16542bcd9d24e
BLAKE2b-256 1ecde6e92e4a8ec4d04555e92b8c0fcea6a5fc9994afcfdab7b6a482e180e799

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page