fluent / fluent/fluent-logger-node
Buffering the logs being send to fluentd when fluentd is not available
- Lingua principale
- JavaScript
- Stelle
- 258
- Fork
- 82
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hey,
We are using your library to send logs from our lambda functions to fluentd via Bunyan Logger.
```
// Instance style fluent-logger creation
const sender = require('fluent-logger').createFluentSender('tag-prefix', {
enableReconnect: false,
host: 'localhost',
port: 24224,
reconnectInterval: 3000,
requireAckResponse: true,
timeout: 3.0
});
// Listener for detecting error events
sender.on('error', (error) => {
console.log('Error found on stream here. ' + error);
// Printing the logs on stdout using the buffer.
});
// bunyan logger instance for sending logs to fluentd.
logger = bunyan.createLogger({
name: 'FluentdLogger',
streams: [{ stream: sender.toStream('fluentd') }]
});
logger.info('this log record is sent to fluent daemon');
```
1. Using the above mentioned approach, the logs are successfully being sent to fluentd from lambda.
2. However, in the case fluentd is _not available_ (not listening at the specified host and port) , then the expected behavior is to send these logs to the **stdout** for displaying.
For point number 2, is there a way to buffer the logs being sent to fluentd and then sending them to stdout instead (inside the error listener)?
It would be great if anyone could advise me on it.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia da createFluentSender, dalle sue opzioni enableReconnect e timeout e dai punti di ingresso dell’evento error del sender e di toStream('fluentd'). Chiarisci il comportamento previsto di buffering e fallback quando Fluentd non è disponibile, quindi determina l’ambito necessario affinché i log raggiungano stdout senza perdere record.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- backend, observability
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100