Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patoi/fastify-fluentd-logging-example
Example: routing docker log message with fluentd, fastify, pino
https://github.com/patoi/fastify-fluentd-logging-example
Last synced: 3 months ago
JSON representation
Example: routing docker log message with fluentd, fastify, pino
- Host: GitHub
- URL: https://github.com/patoi/fastify-fluentd-logging-example
- Owner: patoi
- License: mit
- Created: 2018-03-17T16:24:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-29T17:30:55.000Z (over 6 years ago)
- Last Synced: 2024-07-31T07:18:24.725Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - fastify-fluentd-logging-example - Example: routing docker log message with fluentd, fastify, pino (JavaScript)
README
# Example fluentd configuration for message routing
Fastify logging with pino to standard out from a docker container.
Docker logging with docker fluentd logger settings into a fluentd instance.
This instance writes messages to the standard out.*Goal: you don't need to add fluent dependency to your code,* just logging to standard output.
You can route your log messages with _dest: journal_ key, and it will be saved to journal database, any others will be saved to the log database.Start with ```docker-compose up -d --build```
Log some message with ```http://localhost:4000/?message=cool```
Tail fluentd log with ```docker logs --follow test_fluentd```
Stop with ```CTRL-C``` and ```docker-compose down --remove-orphans```
When you logging with _dest_ key with _journal_ value, then output wil be saved into the journal DB.
```javascript
// saved to journalDB (but not to logDB)
fastify.log.info({dest: 'journal', msg:'journal message'})
// others saved to logDB
fastify.log.info({dest: 'log', msg:'log message'})
fastify.log.info({msg:'log object, but no dest key'})
fastify.log.info('string log message')
```