Skip to main content

Logging Solution

· One min read
Darryl Kanouse

Our logging solution needs to cover these use cases:

  • API logging to know who is accessing the API and what resources they are requesting
  • Application logging to understand system load and performance

In both cases, we also want to be able to capture diagnostic information to troubleshoot errors.

The messages in each use case need a schema to ensure all of the required information is captured with each log entry.

Supplied by the logger module in both cases

  • event_timestamp - Event timestamp (ISO)
  • loglevel - Log level (debug/info/warn/error)

API Logging

Our API is built on FastAPI and runs on ECS containers.

We wrote a custom logger module that sends log messages to SQS.

We use aioboto3 and asyncio for our asynchronous logging solution to ensure that the logging does not slow down API performance.

Our logging module sends events to SQS.

The messages have a schema to ensure all of the required diagnostic information is captured with each event.

Supplied by the calling function

  • api_key
  • program_id
  • url
  • method
  • status_code
  • detail

App Logging