By Rohan Khamkar and Anish Singh Walia
In this tutorial, you will learn how to send logs from Fluent Bit installed on a self-managed MongoDB running on an Ubuntu Droplet to DigitalOcean’s managed OpenSearch database.
OpenSearch is an open-source search and analytics suite that originated as a fork of Elasticsearch and Kibana. It supports real-time data ingestion, advanced querying, and robust security, making it ideal for e-commerce, IT monitoring, and finance applications. With features like SQL query support, machine learning, and alerting, OpenSearch continuously evolves through active community development.
Fluent Bit is a lightweight, open-source log processor and forwarder that collects, processes, and ships log data. Optimized for performance, it’s ideal for resource-constrained environments like containers and edge computing. Fluent Bit efficiently aggregates and forwards logs to various destinations, making it popular for real-time logging and monitoring.
Before you begin, ensure you have:
There are multiple platforms where Fluent Bit can be installed. You will be using an Ubuntu Platform here. Run the following command on your Droplet’s Terminal.
curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
You can access the official documentation for more information.
The Fluent Bit config file is stored at /etc/fluent-bit/fluent-bit.conf
by default. You’ll change the fluent-bit.conf
to send the logs to OpenSearch.
Fluent Bit offers a variety of input plugins that enable it to collect log and event data from different sources. Since you will be sending log from logs files, you will be using tail Input plugin.
Update the fluent-bit.conf
file as follows:
[INPUT]
name tail
Path /var/log/mongodb/mongod.log
You can read more about Input plugins on Fluent Bit’s official Manual.
Similar to input plugins, Fluent Bit provides an output plugin that sends collected and processed logs to different destinations. Since we are sending logs to Opensearch, let’s make use of the Opensearch Output plugin.
[OUTPUT]
Name opensearch
Match *
Host opensearch hostname
port 25060
HTTP_User doadmin #DO Managed OpenSeach username
HTTP_Passwd XXXX #Managed OpenSeach Password
Index mongodb
tls On
Suppress_Type_Name On
You can read more about Output plugins on Fluent Bit’s official Manual.
Once the configurations are set up, start Fluent Bit Service.
systemctl enable fluent-bit.service
systemctl start fluent-bit.service
systemctl status fluent-bit.service
fluent-bit.conf
file.Congratulations! You’ve successfully learned to use Fluent Bit to collect and forward self-hosted MongoDB logs to a DigitalOcean Managed OpenSearch database. We covered configuring Fluent Bit and creating an index pattern in OpenSearch to efficiently monitor and analyze your MongoDB logs.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Helping Businesses stand out with AI, SEO, & Technical content that drives Impact & Growth | Senior Technical Writer @ DigitalOcean | 2x Medium Top Writers | 2 Million+ monthly views & 34K Subscribers | Ex Cloud Engineer @ AMEX | Ex SRE(DevOps) @ NUTANIX
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Jump in! Follow our easy steps to deploy Hugging Face HUGS on DigitalOcean GPU Droplets and bring your AI models to life.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.