a month ago
Anyway to get historical observability logs available in gui at /observability using cli or api
1 Replies
a month ago
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:
an account level API token
a HTTP client that can do GraphQL (or just curl if you want I guess)
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:
If you're using chrome hit
ctrl + shift + Ito open your devtools.move to the network tab and filter down to Fetch/XHR
look for requests titled like
internal?q=observabilityItemorinternal?q=observabilityDashboardsopen 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
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>headerValidate that the data you're getting back is what you want
Move the GraphQL query into your favourite programming language / tool to use it.
LMK if you run into any issues- best of luck