Locomotive

A Railway sidecar service for sending logs to a webhook

Railway
Observability
Containers

Locomotive

Locomotive is a sidecar app I built in collaboration with Brody, an experienced community member in the Discord server for https://railway.app. (You can find his links here and here)

It uses Golang, Docker, and the Railway GraphQL API to send logs from a Railway service to an ingest API from platforms like BetterStack or Axiom, a webhook on Discord, or even your custom webhook server. The project can be found at https://github.com/FerretCode/locomotive.

The project began when I felt as if I was lacking some desired observability from my projects. I frequently check my Discord notifications on my phone, so I figured it would be a worthwhile use of my time to build a service that ships logs from my Railway apps to a place where I can see any errors as they pop up. 

Locomotive originally used Railway's public GraphQL API, polling any service's logs for updates & sending them to a Discord webhook when a new log was detected. I released the initial version at around midnight and went to bed. The following morning, macwilko and Brody from the Railway Discord server reached out to me about improving and adding to Locomotive. Macwilko suggested adding a way to send logs to observability tools like Axiom and BetterStack. Brody messaged me about switching to a GraphQL subscription using the internal Railway API rather than polling the service, and he assisted me with fixing some bugs.

From there, he started adding more features & improvements, making the system more robust and production-ready, including fixing a memory leak.

Locomotive is now a simple-to-configure and robust logging sidecar for Railway apps. More configuration information can be found on the project's README.