mclo.gs, but Reverie branded, and in Rust!
logs README.md
5.2 kB · 80 lines
Markdown
at main

Paste, share & view your logs
Built for Minecraft & Hytale

Features #

  • Share logs by pasting or uploading files
  • Automatic removal of sensitive information (e.g. IP addresses)
  • Short URLs for easy sharing
  • Syntax highlighting
  • Line numbers
  • Direct links to specific lines
  • Error highlighting and stack trace grouping for Minecraft and Hytale log formats

For developers #

  • Upload your logs using the API
  • Add metadata to shared logs, e.g. version numbers, server ids, etc.
  • Retrieve logs and their metadata from the API
  • Open source and self-hostable

Self-hosting #

The server is a single Rust binary that also serves the static files. Build the image from this repository with docker compose build, an example compose file for self-hosting can be found here: docker/compose.production.yaml. A MongoDB instance is also required.

The container listens on plain HTTP on port 80, put a reverse proxy in front of it for TLS. The proxy has to send the Host header through and set X-Forwarded-Proto (or Forwarded), the log and API URLs are built from them. The API is served on the api. subdomain of the same host.

Config #

You can configure mclogs by creating a config.json file in the working directory, see example.config.json or by setting environment variables. Environment variables override settings in the config file. Invalid values stop the server at startup.

Here is a list of all available config options:

Variable / JSON Path Default Description
MCLOGS_STORAGE_TTL
storage.ttl
7776000 (90d) Time until logs are deleted after last view
MCLOGS_STORAGE_LIMIT_BYTES
storage.limit.bytes
10485760 (10 MiB) Maximum size of a log in bytes
MCLOGS_STORAGE_LIMIT_LINES
storage.limit.lines
25000 Maximum number of lines in a log
MCLOGS_MONGODB_URL
mongodb.url
"mongodb://mongo:27017" MongoDB connection URL
MCLOGS_MONGODB_DATABASE
mongodb.database
"mclogs" Name of the MongoDB database
MCLOGS_ID_LENGTH
id.length
7 The default length for new IDs
MCLOGS_LEGAL_ABUSE
legal.abuse
null Public email address to report abuse
MCLOGS_LEGAL_IMPRINT
legal.imprint
null The imprint URL
MCLOGS_LEGAL_PRIVACY
legal.privacy
null The privacy policy URL
MCLOGS_FRONTEND_NAME
frontend.name
null Instance name (defaults to domain)
MCLOGS_FRONTEND_COLOR_ACCENT
frontend.color.accent
#5cb85c The color of /favicon.svg
MCLOGS_WORKER_CONCURRENCY
worker.concurrency
8 Requests handled at once, others wait. Bounds memory use with large logs
MCLOGS_LISTEN
listen
"0.0.0.0:80" Address and port to listen on

The config file is read from config.json in the working directory, set MCLOGS_CONFIG to use another path. Log output can be adjusted with RUST_LOG, e.g. RUST_LOG=debug.

Development setup #

Prerequisites #

Running #

# start MongoDB
docker compose -f dev/compose.yaml up -d

# run the server on port 8080
MCLOGS_MONGODB_URL=mongodb://127.0.0.1:27017 MCLOGS_LISTEN=127.0.0.1:8080 cargo run

Open http://localhost:8080 in browser and enjoy, the API is at http://api.localhost:8080. Templates in templates/ are compiled into the binary, restart cargo run after changing them. Files in web/public/ are read at startup.

Tests #

cargo test

tests/fixtures/ holds output recorded from the previous PHP implementation (the filters and codex's log parsing), the tests check that the Rust implementation still produces the same results.