LogoRobo.js

@robojs/better-stack

Monitor your Robo's uptime and integrate logs with Better Stack.

Install @robojs/better-stack with:

Integrate Better Stack into your Robo for uptime monitoring and centralized log management. This plugin provides two core features: heartbeat monitoring to track whether your Robo is online, and log ingestion to forward structured logs to Better Stack's searchable dashboard.

Features

Heartbeat Monitoring

Periodic pings to track uptime and detect outages

Log Ingestion

Forward structured logs to Better Stack's Logtail service

Uptime Alerts

Get notified through email, Slack, or Discord when your Robo goes down

Searchable Logs

Color-coded, filterable logs in Better Stack's dashboard

Env Config

Secure token management via environment variables

Custom Host

Support for EU region and self-hosted Logtail endpoints

Prerequisites

Sign up for an account at Better Stack before configuring the plugin.

Installation

To install, run:

npx robo add @robojs/better-stack@next

Or create a new project with the plugin pre-installed:

npx create-robo@next my-project -p @robojs/better-stack@next

Heartbeat monitoring

Heartbeat monitoring sends periodic HTTP pings to Better Stack. If pings stop arriving, Better Stack marks your service as down and sends alerts through your configured channels.

config/plugins/roboplay/plugin-better-stack.mjs
export default {
	heartbeat: {
		url: 'https://uptime.betterstack.com/api/v1/heartbeat/your-heartbeat-id'
	}
}
config/plugins/roboplay/plugin-better-stack.mjs
export default {
	heartbeat: {
		url: 'https://uptime.betterstack.com/api/v1/heartbeat/your-heartbeat-id'
	}
}

See Heartbeat for setup instructions and configuration options.

Log integration

Log integration forwards your Robo's log output to Better Stack's Logtail service, providing searchable, color-coded logs with level filtering. There are three ways to configure it.

The simplest approach uses a plugin config file:

config/plugins/roboplay/plugin-better-stack.mjs
export default {
	sourceToken: 'YOUR_UNIQUE_SOURCE_TOKEN'
}
config/plugins/roboplay/plugin-better-stack.mjs
export default {
	sourceToken: 'YOUR_UNIQUE_SOURCE_TOKEN'
}

Or use environment variables for production:

.env
BETTER_STACK_SOURCE_TOKEN="YOUR_UNIQUE_SOURCE_TOKEN"

See Log drain for all configuration methods, log level mapping, and the createLogtailDrain API.

Configuration reference

All plugin configuration options at a glance:

Prop

Type

Environment variables

VariableDescription
BETTER_STACK_SOURCE_TOKENLogtail source token. Overridden by sourceToken in plugin config.
BETTER_STACK_INGESTING_HOSTCustom ingesting host. Overridden by ingestingHost in plugin config.

Plugin config values take precedence over environment variables. Use environment variables for production deployments where tokens should not be committed to version control.

Next Steps

On this page