Query function console logs
Read what a function wrote with console.log from the functionConsoleEvents dataset, in Azion Console and with a GraphQL query.
You can read the lines a function wrote with console.log from Azion Console or with a GraphQL query. Real-Time Events keeps them in the Functions Console data source. The GraphQL API serves the same records as the functionConsoleEvents dataset, named cellsConsoleEvents before.
One request leaves several lines behind it rather than one record. The ID variable, which the GraphQL API names id, is the request identifier, and it groups every line of a single request. A result that holds five rows for one request is the expected shape.
Azion Runtime writes lines of its own alongside the ones your code writes. Line Source separates the two: CONSOLE marks a line written with console.log, and RUNTIME marks a line Azion Runtime produced, such as an exception.
Prerequisites
- A function that has run at least once. Creating a function does not execute it, and a function that never runs writes no lines.
- Access to Azion Console, for the Console procedure.
- A personal token, for the GraphQL query. To create one, refer to Personal Tokens.
Read the lines a function wrote
Both interfaces read the same records, and both bound the search by a period first. The names they take differ. Filter by takes the variable in lowercase with underscores, and the GraphQL API takes the camelCase field, so the variable Function ID reads function_id in one and functionId in the other.
The period a search can ask for and the rows one query returns are both bounded. For each bound, refer to Limits.
To read the lines from Azion Console:
Access Azion Console > Products menu > Observe > Real-Time Events.
In Data Sources, select Functions Console.
In Time Filter, select a period that covers the run you want to read.
In Filter by, enter the identifier of the function:
The table holds the lines that function wrote inside the period, one row per line.
Filter by reads SQL, so key='value' matches a value exactly. Select a row to open More details, which carries every variable of that record, including Line, the message itself. For every variable the data source carries, refer to Data sources.