FerretCode / locomotive

6 stars 2 forks source link

locomotive

A Railway sidecar service for sending webhook events when new logs are received. Supports Discord, Axiom, BetterStack and more!

Configuration

Configuration is done through environment variables. See explanation and examples below.

Generic Webhook Log Formats

These are examples of what the body would look like in the POST request done by locomotive

For Plaintext logs

[
  {
    "_metadata": {
      "deploymentId": "577e2cf2-a1fc-4e0f-b352-2780bca73a94",
      "deploymentInstanceId": "bbdc4e76-7600-415f-9f6b-e425311cec51",
      "environmentId": "b5ce7ab5-96f1-4fa3-929b-fc883f89cbd1",
      "environmentName": "production",
      "projectId": "8a6502bf-6479-440c-a14f-78ecd52abf09",
      "projectName": "Railyard",
      "serviceId": "24335e07-e68b-498f-bc9e-1b9146436867",
      "serviceName": "Autorack"
    },
    "message": "Hello, World!",
    "level": "info",
    "severity": "info",
    "time": "2020-05-22T21:27:33Z",
    "_time": "2020-05-22T21:27:33Z",
    "dt": "2020-05-22T21:27:33Z",
    "datetime": "2020-05-22T21:27:33Z",
    "ts": "2020-05-22T21:27:33Z",
    "timestamp": "2020-05-22T21:27:33Z"
  }
]

For Structured JSON logs

[
  {
    "_metadata": {
      "deploymentId": "5b7c81b35-1578-4eb8-8498-44f4f517b263",
      "deploymentInstanceId": "46cda6d4-f76c-45cb-8642-c7265949e497",
      "environmentId": "b5ce7ab5-96f1-4fa3-929b-fc883f89cbd1",
      "environmentName": "production",
      "projectId": "8a6502bf-6479-440c-a14f-78ecd52abf09",
      "projectName": "Railyard",
      "serviceId": "55b1755f-f2c6-4f24-8d51-0ed3754b253e",
      "serviceName": "Superliner"
    },
    "level": "info",
    "severity": "info",
    "message": "Hello, World!",
    "example_string": "foo bar",
    "example_int": 12345678,
    "example_float": 1.2345678,
    "example_int_slice": [123, 456, 789],
    "example_string_slice": ["hello", "world"],
    "example_group": {
      "example_grouped_int": 12345678,
      "example_grouped_string": "Hello, World!"
    },
    "time": "2020-05-22T21:27:33Z",
    "_time": "2020-05-22T21:27:33Z",
    "dt": "2020-05-22T21:27:33Z",
    "datetime": "2020-05-22T21:27:33Z",
    "ts": "2020-05-22T21:27:33Z",
    "timestamp": "2020-05-22T21:27:33Z"
  }
]

Notes:

All variables:

Log Filtering

You can filter logs by severity level and content using the following environment variables:

Level Filters

Level filter options: ALL, INFO, ERROR, WARN, or any custom combination of severity / level.

Content Filters

Content filters support regular expressions or plain text searches.

Example: