Hey guys, would you please let me know what wrong with the following configuration? Thank you in advance.
Use case
I want to use fluentd to output log data into mongodb
Configuration
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match log.*>
@type stdout
</match>
# Single MongoDB
<match log.**>
@type mongo
database logger
collection label
# Set 'tag_mapped' if you want to use tag mapped mode.
tag_mapped
# for capped collection
capped
capped_size 256m
# key name of timestamp
time_key timestamp
# flush
flush_interval 10s
</match>
'use strict'
var log4js = require('log4js');
log4js.addAppender(require('fluent-logger').support.log4jsAppender('log', {
host: 'localhost',
port: 24224,
timeout: 3.0,
levelTag: true
}));
var logger = log4js.getLogger('foo');
function emit(){
logger.info('this log record is sent to fluent daemon');
}
setInterval(emit, 1000)
Expected result
Having log records in collection label of database logger
Actual result
> use logger
switched to db logger
> db.label.find()
Hey guys, would you please let me know what wrong with the following configuration? Thank you in advance.
Use case
I want to use
fluentd
to output log data intomongodb
Configuration
Test
I used a script provided by fluent-logger-node:
Expected result
Having log records in collection
label
of databaselogger
Actual result