The out_mongo Output plugin writes records into MongoDB, the emerging document-oriented database system.
If you're using ReplicaSet, please see the out_mongo_replset article instead.
This document does not describe all the parameters. For details, check the Further Reading section.
Why Fluentd with MongoDB?
Fluentd enables your apps to insert records to MongoDB asynchronously with batch-insertion, unlike direct insertion of records from your apps. This has the following advantages:
less impact on application performance
higher MongoDB insertion throughput while maintaining JSON record structure
Install
out_mongo is not included in fluent-package, by default. Fluentd gem users will need to install the fluent-plugin-mongo gem using the following command:
# Single MongoDB
<match mongo.**>
@type mongo
host fluentd
port 27017
database fluentd
collection test
# for capped collection
capped
capped_size 1024m
# authentication
user michael
password jordan
<inject>
# key name of timestamp
time_key time
</inject>
<buffer>
# flush
flush_interval 10s
</buffer>
</match>
<match mongo.*>
@type mongo
host fluentd
port 27017
database fluentd
# Set 'tag_mapped' if you want to use tag mapped mode.
tag_mapped
# If the tag is "mongo.foo", then the prefix "mongo." is removed.
# The inserted collection name is "foo".
remove_tag_prefix mongo.
# This configuration is used if the tag is not found. The default is 'untagged'.
collection misc
</match>