HTTP logs: how to see more fields? (user_agent etc.)

AnonymousPRO

2 days ago

We'll no longer be using nginx when if we move to Railway. However our tech SEO team needs HTTP logs with nginx-level detail (e.g. http_user_agent, http_x_forwarded_for, sent_http_location, etc.). How can we export this level of detail from railway?

Currently you don't seem to be able to download 'HTTP logs' from Railway at all (only deployment-specific deploy/build logs are possible to download). And only 5000 lines at a time (our team requires logs for a whole day).

The Railway docs appears to show a screenshot of this kind of nginx-style logs (see just below 'Command Line' here), but I can't seem to get the Railway CLI to output this (not given an option for 'HTTP Logs').

$10 Bounty

3 Replies

alexwebgrHOBBY

2 days ago

Hi there

AFAIK railway logs returns the application logs at least for rails apps it will output the contents of /log/production.log

that means you can log any additional info you need

if you could let me know what is your tech stack, i.e. language / framework along with the values you want to capture, i could propose a way to surface the info you need

thanks

alex


AnonymousPRO

a day ago

Thanks for getting back Alex.

We have a nodejs express app. We can modify our express middleware logger to log the fields we need (such as http_user_agent, http_x_forwarded_for, sent_http_location,), but these will then appear mixed up with all the rest of our web server logs inside Railway's "Deploy logs".

What we want is to have Railway's "HTTP Logs" output more fields as is possible with nginx (currently Railway's "HTTP Logs" only outputs Timestamp, Method, Path, Status, Response Time).


a day ago

We don't support a way for the user to add more fields to our HTTP Logs.

Like alex suggested, you would want to log this information yourself, but you would want to log it as JSON so that you can easily apply a filter to show only HTTP Logs that your application printed.

https://docs.railway.com/guides/logs#filtering-logs


HTTP logs: how to see more fields? (user_agent etc.) - Railway Help Station