Forward logs from Railway (Papertrail)
How it works
-
The Locomotive template runs as a sidecar on Railway, tails the Railway API, and forwards log events to the configured destination.
-
For Papertrail, Locomotive sends RFC 5424-formatted log events to the Papertrail HTTPS bulk endpoint.
-
Railway metadata, such as the project, environment, service, deployment, and deployment instance, is preserved in the forwarded logs.
Prerequisites
-
A Papertrail ingestion token
To get a destination and token in Papertrail, add a new log destination. The ingestion token is generated along with the destination. Use the collector endpoints for your account's region:
-
HTTPS:
https://logs.collector.<REGION>.cloud.solarwinds.com/v1/logs/bulk
Replace
<REGION>with the data center your organization uses:na-01,eu-01, orap-01. -
-
A Railway account-level API token
Project-level, team-scoped, and workspace-level tokens do not work with Locomotive.
-
The Railway environment ID and service IDs whose logs should be forwarded
-
Access to deploy the Locomotive template in Railway
Setup
Use the Locomotive Railway template to deploy the sidecar. The Locomotive source repository contains additional configuration details.
Step 1: Deploy Locomotive
-
Open the Locomotive template in Railway.
-
Deploy the template into the same Railway environment as the services whose logs you want to forward.
-
Provide an account-level Railway API token when prompted.
Project-level, team-scoped, and workspace-level tokens do not work with Locomotive.
Step 2: Configure the required variables
Configure the following variable for the
-
LOCOMOTIVE_RAILWAY_API_KEY=<RAILWAY_ACCOUNT_API_TOKEN> -
LOCOMOTIVE_ENVIRONMENT_ID=<RAILWAY_ENVIRONMENT_ID> -
LOCOMOTIVE_SERVICE_IDS=<SERVICE_ID_1>,<SERVICE_ID_2> -
LOCOMOTIVE_WEBHOOK_MODE=papertrail -
LOCOMOTIVE_WEBHOOK_URL=https://logs.collector.<REGION>.cloud.solarwinds.com/v1/logs/bulk -
LOCOMOTIVE_ADDITIONAL_HEADERS=Authorization=Bearer <TOKEN>
| Variable | Description |
|---|---|
LOCOMOTIVE_RAILWAY_API_KEY
|
The account-level Railway API token used to read logs |
LOCOMOTIVE_ENVIRONMENT_ID
|
The environment containing the services to monitor. The template can auto-fill the current environment ID, but verify that it matches the target services. |
LOCOMOTIVE_SERVICE_IDS
|
One service ID or multiple service IDs separated by commas |
LOCOMOTIVE_WEBHOOK_MODE
|
Set to papertrail to produce the expected RFC5424 log format. |
LOCOMOTIVE_WEBHOOK_URL
|
The HTTPS bulk endpoint for the destination. Replace <REGION> with the |
LOCOMOTIVE_ADDITIONAL_HEADERS
|
The authentication header. Use Authorization=Bearer <TOKEN>. Separate multiple headers with semicolons. |
For Papertrail, use the token shown in the usage instructions for the destination you create.
Step 3: Start the deployment
-
Save the variables, and deploy or redeploy Locomotive.
-
Confirm that Locomotive can access the Railway API and that all configured services exist in the selected environment.
-
Generate a new log event from a Railway service.
Verify ingestion
Confirm that the log appears in the selected account. Railway metadata should be available for filtering, including the project, environment, service, deployment, and deployment instance.
Locomotive maps Railway stream severity to the syslog priority. Logs written to stderr are classified as errors, while logs written to stdout arrive as informational messages.
Remove or reset the configuration
To stop forwarding logs, remove or suspend the Locomotive deployment in Railway. To change the destination, update the Locomotive webhook mode, URL, authorization header, or service list and redeploy.
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.