MQTT Connectivity log
Anonymous
HOBBYOP

a day ago

Hello, do you have log file showing mqtt-broker connectivity status whether its online or offline?

$10 Bounty

1 Replies

Railway
BOT

a day ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway 1 day ago


ayalaa12
FREETop 5% Contributor

a day ago

Railway does not create a separate MQTT connectivity log file. It captures whatever the broker writes to stdout/stderr, so for Mosquitto I would enable connection logging in mosquitto.conf:

log_dest stdout
connection_messages true
log_type error
log_type warning
log_type notice
log_type information
log_timestamp true

Redeploy after changing the config, then use Observability -> Logs for the broker service. You should see Mosquitto's client connect/disconnect entries there; the CLI equivalent is railway logs -s <broker-service> --since 1h. Railway documents the log locations, filters, and retention here: https://docs.railway.com/observability/logs and https://docs.railway.com/cli/logs

Two different statuses are worth separating:

  1. Broker process online/offline: use Railway's deployment/restart state plus an external MQTT connection probe. A broker cannot reliably write an "offline" entry after its process or host has already stopped.
  2. Individual MQTT clients connected/disconnected: connection_messages true writes those events. Mosquitto documents that option and log_dest stdout here: https://mosquitto.org/man/mosquitto-conf-5.html

For an external probe, connect to the exact Railway TCP proxy host and generated port (not an HTTP domain), authenticate, and optionally subscribe to $SYS/broker/uptime or $SYS/broker/clients/connected. Railway's TCP proxy setup is documented here: https://docs.railway.com/networking/tcp-proxy

So the short answer is: there is no Railway-specific MQTT status file; enable broker connection messages to stdout and Railway will retain/search them. Add an external probe if you need a dependable online/offline alert.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...