improve log search with grep features
wahmad
PROOP

9 months ago

Sometimes is useful to search in the logs for some path and read the 2 lines below which include the parameters.

With grep one can pass -A 2 to achieve that (or -B 2 if wants to see lines before the match). It would be nice to have that number as a parameter in the search, like VS Code or Sublime also show in the global search.

Also, if I would like to achieve this via the command line, would be nice to be able to define how many lines I want to pull from the logs, like:

$ railway logs -s web -n 100000 | grep -A 2 POST "/something"

Solved

5 Replies

9 months ago

Hello,

You can view the surrounding log lines, first click the log line, then click the "View in Context" button.

Best,

Brody


Status changed to Awaiting User Response Railway 10 months ago


wahmad
PROOP

9 months ago

I know I can do that, but it's not what I need, especially when one needs to replay hundreds of requests because something went wrong. It's handy to be able to search last few months for one endpoint and get the params along with it, without having to click open hundreds of times and copy/paste 1 by 1.


Status changed to Awaiting Railway Response Railway 10 months ago


9 months ago

Hmm. I'm not sure how we would do that like, user experience wise. Any ideas?

We wouldn't want to add a random setting for just this


Status changed to Awaiting User Response Railway 10 months ago


wahmad
PROOP

9 months ago

My suggestion was to have a field like sublime or VSCode, that defaults to 1. Below with "context lines" = 3:


Status changed to Awaiting Railway Response Railway 10 months ago


9 months ago

Gotchya. Appreciate the feedback we'll look into it for our new logging revamp that we're doing this quarter. Can't make any promises but appreciate it!


Status changed to Awaiting User Response Railway 9 months ago


Railway
BOT

7 months 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 7 months ago


Loading...