a day ago
Hello, do you have log file showing mqtt-broker connectivity status whether its online or offline?
1 Replies
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
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 trueRedeploy 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:
- 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.
- Individual MQTT clients connected/disconnected:
connection_messages truewrites those events. Mosquitto documents that option andlog_dest stdouthere: 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.