MongoDB


MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need.

Integration of MongoDB logs on Ubuntu with DNIF Adapter

To forward MongoDB logs to the DNIF Adapter make the following configuration.

Install syslog package, if you haven’t installed it

apt-get install rsyslog

Checking the rsyslog.conf

Open a rsyslog.conf file located at /etc/rsyslog.conf by following command

vim /etc/rsyslog.conf

At the end of the file check for the following line and uncomment

$IncludeConfig /etc/rsyslog.d/*.conf

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

Save and Quit the configuration file.

Create log configuration for MongoDB with vim /etc/rsyslog.d/mongodblog.conf and paste following lines below

$ModLoad imfile

$InputFileName /var/log/mongodb/mongod.log ##path of log file
$InputFileTag mongod-log:
$InputFileStateFile stat-mongod
$InputFileSeverity info
$InputFileFacility local5
$InputRunFileMonitor

local5.*  @DNIF-Adapter-IP:514

Save and Quit the configuration file.

Restart rsyslog service

service rsyslog restart

MongoDB logs are now being streamed to the DNIF-ADAPTER.

Integration of MongoDB logs on CentOS-RHEL with DNIF Adapter

To forward MongoDB logs to the DNIF Adapter make the following configuration.

Install syslog package, if you haven’t installed it

yum -y install rsyslog

Checking the rsyslog.conf

Open a rsyslog.conf file located at /etc/rsyslog.conf by following command

vim /etc/rsyslog.conf

At the end of the file check for the following line and uncomment

$IncludeConfig /etc/rsyslog.d/*.conf

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

Save and Quit the configuration file.

Create log configuration for MongoDB with vim /etc/rsyslog.d/mongodblog.conf and paste following lines below

$ModLoad imfile

$InputFileName /var/log/mongodb/mongod.log ##path of log file
$InputFileTag mongod-log:
$InputFileStateFile stat-mongod
$InputFileSeverity info
$InputFileFacility local5
$InputRunFileMonitor

$WorkDirectory /var/lib/rsyslog
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList   # run asynchronously
$ActionResumeRetryCount -1

local5.*  @DNIF-Adapter-IP:514

Save and Quit the configuration file.

Restart rsyslog service

service rsyslog restart

MongoDB logs are now being streamed to the DNIF-ADAPTER.