Logging
Last updated
Last updated
Cortex provides a logging solution, out-of-the-box, without the need to configure anything. By default, logs are collected with FluentBit, on every API kind, and are exported to each cloud provider logging solution. It is also possible to view the logs of a single API replica, while developing, through the cortex logs
command.
The cortex CLI tool provides a command to quickly check the logs for a single API replica while debugging.
To check the logs of an API run one of the following commands:
Important: this method won't show the logs for all the API replicas and therefore is not a complete logging solution.
For AWS clusters, logs will be pushed to using fluent-bit. A log group with the same name as your cluster will be created to store your logs. API logs are tagged with labels to help with log aggregation and filtering.
Below are some sample CloudWatch Log Insight queries:
RealtimeAPI:
BatchAPI:
TaskAPI:
Below are some sample Stackdriver queries:
RealtimeAPI:
TaskAPI:
Please make sure to navigate to the project containing your cluster and adjust the time range accordingly before running queries.
You can use Cortex's logger in your Python code to log in JSON, which will enrich your logs with Cortex's metadata, and enable you to add custom metadata to the logs.
See the structured logging docs for each API kind:
Logs will be pushed to using fluent-bit. API logs are tagged with labels to help with log aggregation and filtering.