Comments (4)
Could you show me your full configuration for Fluentd and your JavaScript code to emit log?
I could not reproduce your situation.
from fluent-logger-node.
Sure, what I'm doing is to enhance an existing monitoring tool and the file I'm editing is this: https://gitlab.paragon-es.de/tools/uptime/blob/master/models/ping.js
In the header I've added this:
var logger = require('fluent-logger');
logger.configure('app.uptime', {
host: 'localhost',
port: 24224,
timeout: 3.0,
reconnectInterval: 60000
});
Then, the class builds a Ping object which will be written to a MongoDB in line 72.
In my first approach I have added the following code right before ping.save()
:
logger.emit('test', ping);
That throws the error and as ping contains some other class objects, I thought I should simplify that and tried this:
var LoggerFields = ['timestamp', 'isUp', 'isResponsive', 'time', 'tags', 'monitorName', 'downtime', 'error'];
var log_output = {};
for (var i = 0, len = LoggerFields.length; i < len; i++) {
var name = LoggerFields[i],
value = ping.get(name);
if (value != undefined) {
log_output[name] = value;
}
}
logger.emit('test', log_output);
That throws the same error. Then I casted String(value)
which is then working OK.
Hope that helps you to reproduce this?
from fluent-logger-node.
I got error error_class=MessagePack::UnknownExtTypeError error="unexpected extension type
with following code:
var logger = require('fluent-logger');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
logger.configure('tag_prefix', {
host: 'localhost',
port: 24224,
timeout: 3.0,
reconnectInterval: 600000 // 10 minutes
});
var PingSchema = new Schema({
timestamp : { type: Date, default: Date.now },
isUp : Boolean, // false if ping returned a non-OK status code or timed out
isResponsive : Boolean, // true if the ping time is less than the check max time
time : Number,
check : { type: Schema.ObjectId, ref: 'Check' },
tags : [String],
monitorName : String,
// for pings in error, more details need to be persisted
downtime : Number, // time since last ping if the ping is down
error : String,
details : Schema.Types.Mixed
});
var Ping = mongoose.model('Ping', PingSchema);
var ping = new Ping();
// console.log(JSON.stringify(ping));
//console.log(typeof ping.timestamp);
logger.emit('ping', ping);
Maybe ping.timestamp
is not plain JavaScript object so Fluentd cannot decode from msgpack.
You can send plain JavaScript object with fields what you want (your code is almost good).
Or logger.emit('ping', JSON.parse(JSON.stringify(ping)));
from fluent-logger-node.
Thanks, that should do.
from fluent-logger-node.
Related Issues (20)
- Logger write to socket after it died HOT 1
- A small team looking to iterate on fluent logger node lib HOT 1
- [BUG] Logging multiple tags in PackedForward corrupts packets!
- [BUG] Emit callbacks are re-called when error with ack from Fluent
- error TS2307: Cannot find module 'winston-transport'. HOT 3
- Sender has no support in TypeScript HOT 2
- EnableReconnect not available in winston transport
- App doesn't close when connection failed. HOT 1
- WinstonTransport types don't work anymore after latest release HOT 1
- Trouble with millisecond (or any sub-second) resolution (outdated protocol implementation?)
- Buffering the logs being send to fluentd when fluentd is not available
- Error events take too much time to emit when fluentd is not available HOT 2
- Failed to call _flushSendQueue() during frequent log emit HOT 1
- Sending via udp HOT 1
- Cannot find module 'fluent-logger'
- Cannot read property 'end' of undefined HOT 2
- fluentd winston color formatting doesnt work at transport level HOT 1
- Lambda timeout occurs when using the sender.end() function with setTimeout
- [PROPOSAL] Deprecate in favor of new Fluent Node Logger HOT 1
- MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unpipe listeners added to [FluentTransport]. Use emitter.setMaxListeners() to increase limit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluent-logger-node.