# Baselime CDK Quick Start

Observability is a first class citizen of your infrastructure with Baselime. You can use the AWS CDK to define your observability configurations in Baselime.


# Installation

Download the Baselime CDK on npm: @baselime/cdk

npm i --save-dev @baselime/cdk
yarn add -D @baselime/cdk
pnpm i --save-dev @baselime/cdk

# Configuration

Initialise the Baselime CDK with your Baselime API Key.

index.ts
import { Baselime } from "@baselime/cdk";

Baselime.init(this, {
  apiKey: `<BASELIME_API_KEY>`,
});

# Example alert

Set up an alert everytime there's an error in your application logs:

index.ts
import { Alert, filter } from "@baselime/cdk";

new Alert("service-errors", {
  parameters: {
    query: {
      filters: [
        filter.inArray("LogLevel", ["ERROR", "WARN"]),
      ],
    },
    channels: [{ type: "slack", targets: ["baselime-alerts"] }]
  },
});

This alert will notify you on Slack when there is an event with LogLevel equal "ERROR" in your telemetry data.