Logs Viewer: View Real-Time Logs in Your Browser Easily

pulkit kathuria
web-developer
Published in
4 min readJun 23, 2024

Are you looking for a simple and effective way to view logs in your browser? Introducing “Log Viewer” — a powerful, user-friendly tool designed for real-time log viewing. Whether you need to monitor logs from local files, Docker containers, or remote servers, Logs Viewer makes it effortless. Best of all, it doesn’t require heavy middleware like Elastic Search.

For non medium members, here is the link kevincobain2000/gol: All in One — Dependency free (docker, local, remote) Log Viewer in Browser. Written in GO with God Speed. (github.com)

Web View

Image by Author. Screen shot of view logs in browser using gol.

The screenshot showcases the Logs Viewer interface, a streamlined and intuitive tool for viewing logs in real time directly in your browser. At the top, you can see options to match or ignore specific regex patterns, allowing you to filter logs efficiently. The real-time toggle switch enables live updating of logs as new entries are generated. Below, the interface lists multiple log files, such as testdata/apache.log, testdata/app.log, and testdata/logs.log, with their respective sizes and line counts. The log entries are displayed with color-coded labels indicating log levels (e.g., Debug, Info, Error, Warn, Danger) and timestamps, making it easy to identify and analyze log data quickly. This interface demonstrates the simplicity and effectiveness of Logs Viewer in managing and monitoring logs from various sources in one unified platform.

Why Choose Logs Viewer to View Logs in Browser?

1. Easy Setup

Installing Logs Viewer is a breeze. With just one command, you can install and start viewing logs in your browser. No complicated setup, no extra dependencies — just an easy and quick way to access your logs.

2. No Heavy Middleware Needed

Unlike many other log management tools, Logs Viewer doesn’t need Elastic Search or any other heavyweight middleware. This makes it lightweight and quick, perfect for those who want to keep their log management simple.

3. Cross-Platform Support

Logs Viewer supports various platforms, including arm64, arch64, Mac (including M1), Ubuntu, and Windows. No matter what system you’re using, Logs Viewer ensures you can view your logs in the browser seamlessly.

4. Versatile Log Viewing

Logs Viewer is incredibly versatile. You can view logs from Docker containers, remote servers over SSH, local files, and even piped inputs. This flexibility allows you to consolidate all your logs in one place, directly in your browser.

5. Intelligent Log Management

Logs Viewer is not just about displaying logs; it also intelligently identifies log levels and dates, making it easier to understand and manage your log data.

6. Fast and Advanced Search

Searching through logs is simple and fast with Logs Viewer. It supports advanced searches using regular expressions (regex), helping you find exactly what you need without sifting through endless lines of text.

7. Real-Time Log Monitoring

Logs Viewer excels in real-time log monitoring. As new log entries come in, they appear instantly in your browser, keeping you up-to-date with the latest information.

8. Log Rotation and Change Detection

Logs Viewer supports log rotation and watches for new log files. This means it can automatically handle changes in your log files, ensuring you always have the most current data at your fingertips.

How to Install Logs Viewer

Installing Logs Viewer is straightforward. If you don’t have Go installed on your server, you can use curl, it is a go binary of 10KB in size. You can either install it to current directory and run it without root, or move to the PATH.

curl -sL https://raw.githubusercontent.com/kevincobain2000/gol/master/install.sh | sh

How to Use Logs Viewer

Here are some examples of how to use Logs Viewer:

・Basic Usage

To run Logs Viewer in your current directory for a specific pattern:

gol "*log" "access/*log.tar.gz"

・Advanced Usage

You can combine different patterns and sources:

1. Search Using Pipe and File Patterns

View logs from stdin pipe

dmesg | gol -f="/var/log/*.log"

2. View Logs Over SSH

View remote logs over SSH in browser:

gol -s="user@host[:port] [password=/path/to/password] [private_key=/path/to/key] /app/*logs"

3. View Docker Logs

View all docker container logs in browser:

gol -d=""

View specific docker container logs in browser:

gol -d="container-id"

View logs from a specific path on a container:

gol -d="container-id /app/logs.log"

4. Combine all patterns

gol -d="container-id" \
-d="container-id /app/logs.log" \
-s="user@host[:port] [password=/path/to/password] [private_key=/path/to/key] /app/*logs" \
-f="/var/log/*.log"

Logs Viewer is perfect for developers working with popular frameworks like Laravel, Ruby on Rails, Django, Spring Boot, and Node.js. No matter what framework you’re using, Logs Viewer can seamlessly display your logs in the browser, making it easier to monitor and troubleshoot your applications in real time. This flexibility ensures that you have a unified and efficient way to view logs across all your projects.

Summary

You can check out the source code here: kevincobain2000/gol

For benchmark tests and other information, please checkout the repository. Your feedback is appreciated.

--

--

pulkit kathuria
web-developer

If it is on the internet already, I won’t write about it. Just sharing novel items that I discover during work and find worth sharing.