Skip to content

shobhit99/mrelic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

mRelic

New Relic for localhost

Docker License Next.js PRs Welcome

Beautiful log monitoring for any application, powered by fluent-bit and Next.js.

mRelic Dashboard

Features

  • πŸš€ Zero Configuration: Just pipe your logs to mrelic
  • 🏷️ Auto Service Detection: Service name from directory name
  • 🌐 Beautiful Web UI: Modern, responsive log viewer
  • πŸ” Smart Search: Filter logs by level, service, message content
  • πŸ“Š Real-time Updates: See logs as they arrive
  • πŸ’Ύ Persistent Storage: SQLite database for log history
  • 🐳 Docker Native: Everything runs in containers

Quick Start

The fastest way to get started:

./scripts/quick-start.sh

This will:

  1. Build the Docker image
  2. Start the mrelic server
  3. Set up the mrelic command
  4. Show you how to use it

Manual Setup

If you prefer to set things up manually:

1. Build the Image

docker build -f Dockerfile.mrelic -t repo/mrelic .

2. Start the Server

# Basic setup (port 5959, database at ~/Documents/mrelic.db)
docker run -d --name mrelic-server -p 5959:5959 -v ~/Documents:/data repo/mrelic

# Custom port and database location
docker run -d --name mrelic-server -p 8080:8080 -v ~/Documents:/data repo/mrelic --port 8080 --db /data/custom.db

3. Set up the mrelic command

./scripts/build-mrelic.sh

Usage

Once set up, you can use mrelic with any application:

# Go application
cd my-go-service
mrelic go run main.go
go run main.go | mrelic

# Node.js application
cd my-node-service
mrelic npm start
npm start | mrelic

# Python application
cd my-python-service
mrelic python app.py
python app.py | mrelic

# Any application that outputs logs
cd any-service
./my-app | mrelic

Visit the web interface on http://localhost:5959

How It Works

  1. Service Detection: The mrelic command automatically detects your service name from the current directory
  2. Dynamic Configuration: It creates a fluent-bit config file with your service name
  3. Log Processing: Fluent-bit processes your logs and sends them to the prettylogs server
  4. Web Interface: View and analyze your logs at http://localhost:5959

Configuration

Environment Variables

  • MRELIC_HOST: Server host (default: localhost)
  • MRELIC_PORT: Server port (default: 5959)
  • PORT: Web interface port (default: 5959)
  • DB_PATH: Database file path (default: ~/Documents/mrelic.db)

Custom Database Location

docker run -d --name mrelic-server -p 5959:5959 \
  -v /path/to/your/data:/data \
  repo/mrelic --db /data/logs.db

Custom Port

docker run -d --name mrelic-server -p 8080:8080 \
  repo/mrelic --port 8080

Management

# View server logs
docker logs mrelic-server

# Stop server
docker stop mrelic-server

# Start server
docker start mrelic-server

# Restart server
docker restart mrelic-server

# Remove server (keeps data if using volumes)
docker rm mrelic-server

Troubleshooting

Server not starting

docker logs mrelic-server

Can't connect to server

  1. Check if container is running: docker ps
  2. Check port mapping: docker port mrelic-server
  3. Test connection: curl http://localhost:5959/api/health

mrelic command not found

Make sure you ran the setup script or manually created the command as shown above.

Advanced Usage

Multiple Services

Each service automatically gets its own configuration based on the directory name:

cd payments-service
go run main.go | mrelic  # Shows as "payments-service"

cd user-service
python app.py | mrelic   # Shows as "user-service"

Custom Service Names

You can override the service name by setting the directory name or using a custom approach in your application.


Need help? Check the logs with docker logs mrelic-server or visit the web interface at http://localhost:5959

About

New relic for localhost

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors