Deploy Monirail - Log Monitoring
Set up alerting for logs and metrics using a Railway function
Monitoring
Just deployed
/data
Deploy and Host Monirail - Log Monitoring on Railway
Monitor Railway services and notify your team when issues are detected. This is hosted in a lightweight Railway function and is fully customizable by editing the source code.
Quick Start
import { monitor, source, notify, watch } from "monirail";
// Create a Slack notifier
const slack = notify({
type: "slack",
webhookUrl: process.env.SLACK_WEBHOOK_URL,
});
// Monitor for errors in your logs
const errorMonitor = monitor({
name: "Error Alert",
type: "match",
source: source({ type: "environment_logs" }),
filter: "@level:error",
notify: [slack],
});
// Monitor CPU usage
const cpuMonitor = monitor({
name: "High CPU",
type: "threshold",
source: source({
type: "metrics",
aggregate: "avg",
measure: "CPU_USAGE",
}),
value: 80,
notifyOn: "above",
notify: [slack],
});
// Check monitors every minute
watch(1, [errorMonitor, cpuMonitor]);
Common Use Cases
- Monitor a single service or the entire environment's logs
- Monitor a service's HTTP logs
- Monitor a service's metrics
- Send notifications to Discord, Slack, Pagerduty, Webhooks, or a custom provider (e.g. email)
About Hosting
Why Deploy
Dependencies for
Deployment Dependencies
Template Content
Monitoring
ghcr.io/railwayapp/function-bun:1.3.0RAILWAY_API_TOKEN
A Railway API token
DISCORD_WEBHOOK_URL
A Discord webhook URL to push alert notifications to