Skip to main content

Fluentd logger client for HTTP input

Project description

Fluent HTTP Python Logger Handler

A logger handler for fluentd logging collector.

How to use it

import logging
from fluent_http import FluentHttpHandler

logger = logging.getLogger(__name__)
fluent_http_handler = FluentHttpHandler(url='localhost', port=9880, tag='app.python')
logger.addHandler(fluent_http_handler)

# Test it!
logger.warning('Houston, we have a problem')

JSON logging

Install python-json-logger before

pip install python-json-logger
import logging
from pythonjsonlogger import jsonlogger
from fluent_http import FluentHttpHandler

logger = logging.getLogger(__name__)
fluent_http_handler = FluentHttpHandler(url='localhost', port=9880, tag='app.python')
fluent_http_handler.setFormatter(jsonlogger.JsonFormatter(timestamp=True))
logger.addHandler(fluent_http_handler)
logger.setLevel(logging.INFO)
# Test it!
logger.info('purchase done', extra={'item_id': 12345, 'quantity': 4, 'total_price': 32412})

Protected under Auth Basic HTTP

...
fluent_http_handler = FluentHttpHandler(url='https://fluent.example.com', port=443, tag='app.python', username='user', password='a_password')
...

License

MIT License

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

fluent-http-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fluent_http-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file fluent-http-0.1.0.tar.gz.

File metadata

  • Download URL: fluent-http-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.1

File hashes

Hashes for fluent-http-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f85cafa191923ad3a3d59e9a930de2598d0b1c73d9974f1fa7229b41c619dfb
MD5 e2703aa8a98dc29a1b22fa6a6dd69ca6
BLAKE2b-256 0a97c984686ffe4a9a7e7ec2bdfca677c73db1fe4d3513cd82b121793cd8e7e7

See more details on using hashes here.

File details

Details for the file fluent_http-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fluent_http-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.1

File hashes

Hashes for fluent_http-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb691168a74a3bbc2336f488bed01536c11a036f4960dbd004889f75c7a03a90
MD5 edb0feae7c457ffda09d45fcabfa882f
BLAKE2b-256 b5c1f520ce17566244d5d787db0371fc447273ef5ed9f403af543cecc374c7e5

See more details on using hashes here.

Supported by

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