Many web/mobile applications generate huge amount of event logs (c,f. login, logout, purchase, follow, etc). To analyze these event logs could be really valuable for improving the service. However, the challenge is collecting these logs easily and reliably.
[Fluentd](http://github.com/fluent/fluentd) solves that problem by having: easy installation, small footprint, plugins, reliable buffering, log forwarding, etc.
**fluent-logger-python** is a Python library, to record the events from Python application.
## Installation
This library is distributed as 'fluent-logger' python package. Please execute the following command to install it.
$ pip install fluent-logger
## Configuration
Fluent daemon must be lauched with the following configuration:
<source>
type tcp
port 24224
</source>
<match app.**>
type stdout
</match>
## Usage
### Event-Based Interface
First, you need to call logger.setup() to create global logger instance. This call needs to be called only once, at the beggining of the application for example.
By default, the logger assumes fluent daemon is launched locally. You can also specify remote logger by passing the options.
from fluent import sender
# for local fluent
sender.setup('app')
# for remote fluent
sender.setup('app', host='host', port=24224)
Then, please create the events like this. This will send the event to fluent, with tag 'app.follow' and the attributes 'from' and 'to'.
from fluent import event
# send event to fluentd, with 'app.follow' tag
event.Event('follow', {
'from': 'userA',
'to': 'userB'
})
### Python logging.Handler interface
This client-library also has FluentHanler class for Python logging module.
import logging
from fluent import handler
logging.basicConfig(level=logging.INFO)
l = logging.getLogger('fluent.test')
l.addHandler(handler.FluentHandler('app.follow', host='host', port=24224))
l.info({
'from': 'userA',
'to': 'userB'
})
## Contributors
* [Ken Sato](https://github.com/ksato9700)
* [Naoki Inada](http://github.com/methane)
## License
Apache License, Version 2.0
Metadata
Release files for fluent-logger 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fluent-logger-0.3.0.tar.gz | 3.8 kB | Without provenance | Details for fluent-logger-0.3.0.tar.gz |
Release files / fluent-logger-0.3.0.tar.gz
| Download URL | fluent-logger-0.3.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f5f25411b355d86cd1fe960c2c848410dae2af3674b8766424c69cd64d335f8
|
|
BLAKE2b-256 checksum How to use checksums |
1f2212d58f99f13c637b27cca8bd5aac0ed2536b9a63a711ef885dc5e27f64e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for fluent-logger 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.