Skip to content
PostgreSQL Logging and SSH Tunnel Privacy on Railway
edmundtohir
OP

10 days ago

Hello Railway Community,

I'm reviewing the logging and privacy behavior of PostgreSQL services hosted on Railway.

Could someone clarify:

  1. Does Railway collect PostgreSQL stderr output when the database has logging_collector=off?
  2. Does Railway's SSH database tunnel record SQL statements, query parameters, or query results?
  3. Can Railway's infrastructure, proxy, or observability systems capture SQL query text or result payloads?
  4. What are the retention periods and access controls for these logs?

I'm looking for general platform behavior, not troubleshooting a specific database.

Official Railway documentation or confirmation from Railway staff would be appreciated.

Thank you!

Solved

5 Replies

Railway
BOT

10 days ago

Yes, we capture everything a service writes to stdout and stderr as deployment logs. With logging_collector=off, Postgres sends its server log to stderr, so whatever Postgres is configured to log ends up in those logs. That includes statement text if settings like log_statement or log_min_duration_statement are enabled, and nothing extra if they are not.

Our TCP proxy, which handles public database connections, passes the byte stream through to the database. It records connection-level metadata such as the client address and when connections open and close. We do not log SQL text or result payloads as part of that relay. Our HTTP access logs are a separate path and do not apply to database traffic.

An SSH tunnel through railway ssh or ssh -L connects from inside the container, and only to the container's own loopback or your project's private network. We have not verified for this reply whether the SSH layer records anything about the traffic that goes through a tunnel, so we are not making a claim about that layer either way.

All of these logs are kept for 90 days and stored in US West, whatever region you deploy to. Your plan sets how far back you can view them: 3 days on Free, 7 on Trial and Hobby, and 30 on Pro. Individual log entries can't be deleted or redacted early, so the most effective control is to keep sensitive statements out of Postgres's own logging configuration.


Status changed to Awaiting User Response Railway • 10 days ago


Railway

Yes, we capture everything a service writes to stdout and stderr as deployment logs. With `logging_collector=off`, Postgres sends its server log to stderr, so whatever Postgres is configured to log ends up in those logs. That includes statement text if settings like `log_statement` or `log_min_duration_statement` are enabled, and nothing extra if they are not. Our TCP proxy, which handles public database connections, passes the byte stream through to the database. It records connection-level metadata such as the client address and when connections open and close. We do not log SQL text or result payloads as part of that relay. Our HTTP access logs are a separate path and do not apply to database traffic. An SSH tunnel through `railway ssh` or `ssh -L` connects from inside the container, and only to the container's own loopback or your project's private network. We have not verified for this reply whether the SSH layer records anything about the traffic that goes through a tunnel, so we are not making a claim about that layer either way. All of these logs are kept for 90 days and stored in US West, whatever region you deploy to. Your plan sets how far back you can view them: 3 days on Free, 7 on Trial and Hobby, and 30 on Pro. Individual log entries can't be deleted or redacted early, so the most effective control is to keep sensitive statements out of Postgres's own logging configuration.

edmundtohir
OP

10 days ago

Thank you for the explanation.

I still need clarification on one point:

Does Railway's SSH database tunnel (railway connect Postgres --ssh) record or retain SQL statements, query parameters, or query result payloads?

Could a Railway staff member confirm this, or point me to official documentation covering SSH tunnel logging and retention?

The previous automated response stated that this behavior was not verified.

Thank you.


Status changed to Awaiting Railway Response Railway • 10 days ago


Railway
BOT

10 days ago

With railway connect postgres --ssh, the CLI opens an SSH tunnel to the database service, and the connection is made from inside the container to the container's own loopback address, so psql traffic reaches Postgres the same way a local connection would. Traffic passing through that tunnel is not written to your service's deployment logs.

What does reach those logs is whatever Postgres itself writes to stderr. So with log_statement, log_min_duration_statement, and similar settings left off, statement text and parameters stay out of the logs for tunnelled sessions as well. Postgres never writes query results to its server log.

We can't give a definitive statement here about whether the SSH relay keeps anything beyond connection-level session details, so we are not making a claim about that layer. The logs that are retained are kept for 90 days and stored in US West, with plan-based viewing windows of 3 days on Free, 7 on Trial and Hobby, and 30 on Pro. See the railway connect and railway ssh references.


Status changed to Awaiting User Response Railway • 10 days ago


edmundtohir
OP

10 days ago

Thank you for the clarification.

For a security assessment, could an authorized Railway security or infrastructure team member confirm whether the SSH relay used by railway connect postgres --ssh:

  1. Logs, buffers, inspects, or retains decrypted SQL statements, parameters, or result payloads.
  2. Retains any tunnel traffic beyond connection/session metadata.
  3. Applies specific retention periods and access controls to SSH relay data.

If this cannot be confirmed publicly, please indicate the appropriate private security-assurance channel.

A written confirmation of the documented behavior and limitations is sufficient. No access to logs, credentials, or configuration changes is requested.


Status changed to Awaiting Railway Response Railway • 10 days ago


Railway
BOT

10 days ago

SSH sessions to your services, including the tunnel opened by railway connect postgres --ssh, are recorded only at the session level. We do not keep a transcript, command history, or the payload bytes that pass through a tunnel, so SQL statements, parameters, and result payloads carried over the tunnel are not logged or retained by that layer. For a tunnel, the destination port is recorded, and the traffic is not.

What is kept is an audit event in your workspace audit log when a session authenticates. It holds the SSH key fingerprint, the source IP, the target service and deployment, how the session was opened, and the port for tunnel access. That event is the whole record, and you can see it yourself in your workspace audit logs. The viewing window is 2 days on Trial, Free and Hobby, 30 days on Pro, and 18 months on the committed-spend tier. That window is how far back you can view events, not a deletion schedule.

Separately, anything Postgres writes to stderr ends up in your deployment logs. Those logs are kept for 90 days and stored in US West, so your Postgres logging settings decide whether statement text appears there.


Status changed to Awaiting User Response Railway • 10 days ago


Railway
BOT

3 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • 3 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...