Anyway to get historical observability logs available in gui at /observability using cli or api
sharanry
PROOP

a month ago

Anyway to get historical observability logs available in gui at /observability using cli or api

$10 Bounty

1 Replies

Yup! everything you see in the Railway web app is available through their GraphQL API if you're using an account token and have the right variables.

Things to have before you start:

  1. an account level API token

  2. a HTTP client that can do GraphQL (or just curl if you want I guess)

  3. your workspace ID, your environment ID, and your project ID from the project you're interested in.

Getting the data

The easiest thing to do would be to identify which metrics you want in the observabiltiy dashboard then start snooping around in your Browser's Network Panel:

  1. If you're using chrome hit ctrl + shift + I to open your devtools.

  2. move to the network tab and filter down to Fetch/XHR

  3. look for requests titled like internal?q=observabilityItem or internal?q=observabilityDashboards

  4. open those requests up by clicking on them and check out the payload (to see what the GraphQL query and variables look like) and the Response to see what data is returned

  5. when you find the metrics you want, copy the query and the variables into your HTTP client and send a post request with a JSON body containing the same thing you found in the network tab + an Authorization: Bearer <your-account-token> header

  6. Validate that the data you're getting back is what you want

  7. Move the GraphQL query into your favourite programming language / tool to use it.

LMK if you run into any issues- best of luck


Loading...