Monitoring Nginx with @sherlog/cli

Monitoring Nginx with @sherlog/cli

In-Memory observability tool for service logs

Logs play a very important role throughout the entire life cycle of an application development as well as troubleshooting and replicating bugs on production that could lead to service interruption and harm our user's experience.

A few months ago, I went on a journey for finding a tool that will allow me to improve logs visibility and to take action as quickly as possible, and of course with a minimum amount of effort and server requirements. I found many of them, the vast majority very appealing with endless features to the point where it started feeling somewhat overwhelmed. None of these tools however, were easy to set up and they all required a learning curve to take advantage of it's full potential. Not to mention, the majority weren't free and pricing will range depending on the retention period, number of instances, license, etc.

My goal was to simply run a command, get what I needed and continue with my life. All in sudden, I was hit with the aha moment! Why don't I write a simple tool that attempts to solve the problem? So here I am, a few months after, sharing my approach at tackling this problem.

@sherlog/cli requires node >= 12.

For this example, I'm using nvm to install the minimum required version

Run the following commands in your terminal:

nvm install v12.16.1
npm install -g @sherlog/cli

Initialize the project

sherlog init

The previous command generates a .sherlog config file in your current working directory (no biggie, just another JSON). Fill in the blanks. Once configured, it should look similar to this.

  "hostname": "",
  "backpressure": 1000,
  "chunks": 500,
  "compression": true,
  "files": [{
    "metric": "nginx",
    "file": "/var/log/nginx/access.log",
    "eventType": "http",
    "timezone": "UTC",
    "fromBeginning": true

This file can be committed to your repository to speed up the process next time you need to check your logs on different environments. Lets go ahead and start the service.

sherlog start

This will output the following in your terminal

Sherlog listening on:

   - Dashboard:   http://localhost:8000
   - Local:       ws://localhost:8000
   - Network:     ws://

Navigate to the dashboard url http://localhost:8000

Prisma Client

Now you can navigate through your logs as if you were watching a YouTube video going back and forth in case you missed something.

@sherlog/cli supports the following default log formats out of the box:

  • apache2
    • http
    • error
  • monolog (e.g. Laravel)
  • mysql
    • general
  • nginx
    • http
    • error
  • php-fpm
  • redis

That's it for now folks, if you wish to get updates about @sherlog/cli and possible use cases you can follow me on Twitter @Brucelampson or feel free to submit a pull request to the project on GitHub sherl0g

nginx devops logs nodejs server

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Extend your DevOps Strategy For Success in the Cloud?

DevOps and Cloud computing are joined at the hip, now that fact is well appreciated by the organizations that engaged in SaaS cloud and developed applications in the Cloud. During the COVID crisis period, most of the organizations have started using cloud computing services and implementing a cloud-first strategy to establish their remote operations. Similarly, the extended DevOps strategy will make the development process more agile with automated test cases.

What Is DevOps and Is Enterprise DevOps Any Good?

What is DevOps? How are organizations transitioning to DevOps? Is it possible for organizations to shift to enterprise DevOps? Read more to find out!

July patches for Azure DevOps Server and Team Foundation Server

This month, we are releasing fixes that impact our self-hosted product, Azure DevOps Server 2019, as well as Team Foundation Server 2018.

Updated: Announcing Azure DevOps Server 2020 RC1 | Azure DevOps Blog

Update: We received feedback in this blog and the Developer Community about an issue after upgrading from Azure DevOps Server 2019 Update 1.1 to Azure DevOps Server 2020 RC1.

DevOps Basics: What You Should Know

What is DevOps? What are the goals it helps achieves? What are its benefits? This article has answers!