Free Report! Gartner® Hype Cycle™ for Monitoring and Observability.Read more
Log Management

Log Management for the MEAN Stack Framework

Deepa Ramachandra
Deepa Ramachandra

MEAN is evolving as a popular web stack for developing cloud-native applications because of its scalability, ease of extension, and high reliability. Each component in MEAN is built on JavaScript, contributing to a cohesive development platform. In this post, we take you through the log management options available for each component of the MEAN stack framework and their respective limitations – limitations that are addressable with a refined log management solution like observIQ. But first, here’s a rundown of the functionality of each of the components in the framework:


MongoDB is an open-source and NoSQL, object-oriented database management system. Using MongoDB as the database for this framework simplifies the movement of objects between the application and the database. The MEAN stack, wholly built on JavaScript, eliminates the need to translate the objects during this movement. MongoDB is highly malleable, and extending the database's resources is achievable in simple steps.


Express serves as the backend of the MEAN stack, facilitating the data and request transfer between the application's front end and the database. This web framework is specifically designed for use with Node.js, contributing to a complete JavaScript stack. Using Express declutters, the application’s backend is structured with concise requests and responses from and to the backend.


AngularJS is Google’s JavaScript frontend framework, considered an industry standard for frontend development. Its supreme architecture, code reusability, and plug-and-play components fine-tune the development experience. It offers a highly expressive environment for cross-platform functionalities through a highly integrative HTML and application component framework.


Node.js is an open-source JavaScript framework that uses asynchronous events to process multiple connections simultaneously.

Most applications on the web use Node to process multiple asynchronous events in unison. Its high scalability in handling a constantly increasing volume of requests gives this framework an edge over the other options. It serves data quickly and efficiently at the center of a MEAN stack’s framework. Express.js is purpose-built to work with both Node.js and Angular.js.

Existing Log Management for Node

Node has an expansive logging functionality structured using JSON with advanced logging patterns and recorded data fields. Both on-prem and cloud-native Node applications have two logging options: logging to an exportable file or forwarding logs directly to a log management application. Logging Node.js applications is done via third-party libraries such as Winston, Pino, and Morgan.

For containerized and orchestrated applications built on the MEAN stack framework, it is recommended to use the console’s transport option to create the path to finally output logs to the container/ orchestrator’s centralized logging location.


Winston is the logging library of choice for most MEAN stack applications. Winston gives the extensibility and flexibility needed to log significant application events. Using Winston as your log shipper, you can:

  1. Define logging levels based on your application needs. Adding a logging level increases the visibility into severe issues and assists with creating a meaningful categorization for any application activity. By default, Winston logs events based on the npm priority protocol that categorizes logs into six priority levels ranging from 0 to 5, 0 being the most critical and five the least in severity. Alternatively, you can set it to follow the Syslog protocols.
  2. Winston offers three log transport options: console, file, and HTTP. The term transport is used in Winston to denote the storage and output of logs.
  3. You are adding meaningful and diagnostic metadata to your logs globally and locally. This is a foolproof way to read the fine-grain details of application requests during troubleshooting. For instance, adding the user’s geographic location to access logs helps identify application issues affecting users from specific geography.
  4. Categorization and sub-categorization options are available to add more context to logs.
  5. Logging in JSON is always the best way to output your logs for easy parsing into a log management application.
  6. Use Winston’s exception handling library to log application exceptions. Winston does not log exceptions by default.


Pino is a fast logging option for MEAN stack applications. It offers a command-line logging interface that decouples the log processing, alerting, and reformatting into separate processes to overcome Node’s single-threaded event loop. For faster performance, Pino offers an extreme mode setting. Logs are written directly to the output stream in this mode to increase efficiency. Pino does this in chunks, which is the downside of using Pino because chunk output may result in missing out on some logs during downtime or outage.


Morgan simplifies the process of logging HTTP requests. It is a logging library and not a log shipper like Winston. The automatic logging capabilities of Morgan save developers time by eliminating the need to code the application to log all HTTP requests manually. Morgan logs in the Apache combined log format, and Winston needs to forward the logs to any external application for analysis and log management.

Existing log management for Mongo Logs

By default, MongoDB outputs logs in the JSON format for database events such as entries, commands run, and issues. In container-orchestrated applications, MongoDB offers many options to monitor the cluster. When troubleshooting, the log granularity can be fine-tuned to get insights into every detail in the database. The most critical log information you can read and actions that you can take to make logs from Mongo useful:

  1. The general health of the database, factoring the uptime, and a time-wise availability for each database counters.
  2. In the case of containerized and orchestrated applications, the server and database sharing performance statistics are deciphered from inspecting the performance of the daemon and cluster components.
  3. Server performance logs can give a statistical overview of the time to execute a query based on a collection or the entire database.
  4. Set log verbosity levels or view logs in a command-line interface for elaborate analysis.
  5. Gauging load limits and setting thresholds based on currently available infrastructure.

Mongo offers a free log monitoring service named Mongo Atlas, which aggregates Mongo logs and provides insightful metrics. This is exclusive to Mongo logs only and not applicable to the whole stack.

observIQ Solution

We have a more streamlined and cohesive approach to MEAN stack application in the works. This solution brings unparalleled visibility into your logs and gives you much-needed relief from numerous configurations and preset alterations to aggregate your logs into a unified interface. Follow our blogs to get updates related to this.

Deepa Ramachandra
Deepa Ramachandra

Related posts

All posts

Get our latest content
in your inbox every week

By subscribing to our Newsletter, you agreed to our Privacy Notice

Community Engagement

Join the Community

Become a part of our thriving community, where you can connect with like-minded individuals, collaborate on projects, and grow together.

Ready to Get Started

Deploy in under 20 minutes with our one line installation script and start configuring your pipelines.

Try it now