Errsole

How to run the Errsole Log Viewer as a standalone application

By default, Errsole runs its log viewer as a child process of your Node.js application. This setup works well for most use cases—but there are scenarios where you might want to run the log viewer independently.

This guide explains how to run the Errsole Log Viewer as a standalone application.

 This guide assumes you know how to set up Errsole. If not, check out the Errsole Setup Guide first.
 The example below uses MySQL as the storage, but you can use any supported storage (e.g., MongoDB, PostgreSQL, etc.).

Step 1: Disable the log viewer in your app

In your app (or script), initialize Errsole with enableDashboard: false. This ensures that Errsole only collects and stores logs without starting the log viewer.

Example
errsole.initialize({
  storage: new ErrsoleMySQL(options),
  appName: 'your-app-name',
  enableDashboard: false // Important!
});

Step 2: Create a separate app for the log viewer

On the same machine or a different one, start a separate Node.js app whose only job is to run the log viewer. Just make sure it uses the same storage configuration as your main app.

1. Create a new project directory
mkdir log-viewer
cd log-viewer
2. Initialize a new Node.js project
npm init -y
3. Install the required packages
npm install errsole errsole-mysql
4. Create an index.js file with this code
const errsole = require('errsole');
const ErrsoleMySQL = require('errsole-mysql');

errsole.initialize({
  storage: new ErrsoleMySQL(options), // Same config as your main app
  appName: 'your-app-name',
  enableDashboard: true,              // Enable the dashboard here
  port: 8001                          // Choose any available port
});
5. Start the log viewer app
node index.js

Once running, the log viewer will be accessible at:

Local:
http://localhost:8001
Remote:
http://your-server-ip:8001
http://your-domain:8001
Optional: Configure NGINX Reverse Proxy

If you are hosting your log viewer behind NGINX, you can expose it at a clean URL path like /your-app-name/logs/.

Here is a sample NGINX configuration:

location = /your-app-name/logs {
  return 301 /your-app-name/logs/;
}
location /your-app-name/logs/ {
  proxy_pass http://localhost:8001/;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
}
 Note: Replace /your-app-name/logs and /your-app-name/logs/ with the desired URL path where you want the log viewer to be accessible.

After updating the configuration, reload NGINX to apply the changes:

sudo nginx -s reload

You can now access the Errsole Log Viewer through your domain:

HTTP: http://your-domain/your-app-name/logs/
HTTPS: https://your-domain/your-app-name/logs/
 Note: Replace /your-app-name/logs/ in the URLs above to match the path you configured in NGINX.

That’s it!

With this setup, your Errsole Log Viewer will always be available—no matter what happens to your app. Explore the full documentation here: https://github.com/errsole/errsole.js

Building Errsole — Worked in startups — Built products from scratch — Passionate about coding and innovation

Write A Comment