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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for fluent_http-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb691168a74a3bbc2336f488bed01536c11a036f4960dbd004889f75c7a03a90 |
|
MD5 | edb0feae7c457ffda09d45fcabfa882f |
|
BLAKE2b-256 | b5c1f520ce17566244d5d787db0371fc447273ef5ed9f403af543cecc374c7e5 |